Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




unstick_post [ WordPress Function ]

unstick_post ( $post_id )
Parameters:
  • (int) $post_id Post ID.
Defined at:



Unstick a post.

Sticky posts should be displayed at the top of the front page.

Source


<?php
function unstick_post($post_id) {
    
$stickies get_option('sticky_posts');

    if ( !
is_array($stickies) )
        return;

    if ( ! 
in_array($post_id$stickies) )
        return;

    
$offset array_search($post_id$stickies);
    if ( 
false === $offset )
        return;

    
array_splice($stickies$offset1);

    
update_option('sticky_posts'$stickies);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics