Disable sticky posts feature

I need to create a custom WordPress admin interface for a client. I want to completely disable the sticky post feature from admin area.

I found some posts on the internet that suggest to hide the checkbox using css, but I would really like to disable that feature both from edit and from quick edit screen.

Any ideas?

3 Answers
3

In addition to CSS you could try to unstick each post as soon as it has been made sticky (untested):

add_action( 'post_stuck', function( $post_id )
{
    unstick_post( $post_id );
} );

If you’re looking for another approach, than hiding it from the UI with CSS, then consider using custom post types instead of the post post type.

As far as I remember the sticky UI feature is only supported by the post post type. At least a quick look at the posts list table class, shows a check like this one:

if ( 'post' === $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {

But not using the post post type, might not be suitable in many cases, and it might need further adjustments for your site.

Leave a Comment