Is there a way to disable the sticky posts feature?

I want to turn this off as I have a custom ordering process using custom fields.

Related posts

Leave a Reply

2 comments

  1. You can’t turn it off, because it’s hard-coded into the submit metabox for the post post type, you can however hide the sticky checkbox and update the sticky array to unstick any currently stuck posts.

    Hide the sticky checkbox

    Add additional CSS to the post and post-new pages

    add_action( 'admin_print_styles', 'hide_sticky_option' );
    function hide_sticky_option() {
        global $post_type, $pagenow;
        if( 'post.php' != $pagenow && 'post-new.php' != $pagenow )
            return;
        ?>
        <style type="text/css">#sticky-span { display:none!important }</style>
        <?php
    }
    

    Unstick any currently stuck posts

    Add this one of your theme files, load a page that calls that file, then remove

    update_option( 'sticky_posts', array() );
    

    Hope that helps. 🙂

  2. Your code was really helpful for me, but the “sticky post” option is still showing on the quick edit at the “All posts” page, so I’ve made some changes to fix this:

    // Hide sticky posts
    add_action( 'admin_print_styles', 'hide_sticky_option' );
    function hide_sticky_option() {
    global $post_type, $pagenow;
    if( 'post.php' != $pagenow && 'post-new.php' != $pagenow && 'edit.php' != $pagenow )
        return;
    ?>
    <style type="text/css">#sticky-span { display:none!important }
    .quick-edit-row .inline-edit-col-right div.inline-edit-col > :last-child > label.alignleft:last-child{ display:none!important; }</style>
    <?php
    }
    
    // Unsticky all posts
    update_option( 'sticky_posts', array() );