wp_unique_post_slug

FUNCTION wp-includes\post.php (ligne 5450) github
Computes a unique slug for the post, when given the desired slug and some post details.

Paramètres

Entrée :
$slug, $post_id, $post_status, $post_type, $post_parent
Sortie :
@param string $slug        The desired slug (post_name).
@param int    $post_id     Post ID.
@param string $post_status No uniqueness checks are made if the post is still draft or pending.
@param string $post_type   Post type.
@param int    $post_parent Post parent ID.
@return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)

Utilisation

// Utilisation de la fonction wp_unique_post_slug
$result = wp_unique_post_slug($slug, $post_id, $post_status, $post_type, $post_parent);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...