Is there a way to disable the sticky posts feature?

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() { … Read more

Exclude drafts in all() view of edit.php

The show_in_admin_all_list parameter in the register_post_status() function, determines if a given post status is included in the All post table view. Probably the shortest version is: add_action( ‘init’, function() use ( &$wp_post_statuses ) { $wp_post_statuses[‘draft’]->show_in_admin_all_list = false; }, 1 ); but let’s avoid modifying the globals directly like this and override the default draft status … Read more

Modifying admin sidebar contents to show pending posts indicator

@ign Replace the line of code you posted with the following.. foreach( $menu as $menu_key => $menu_data ) : if( ‘edit.php’ != $menu_data[2] ) continue; $menu[$menu_key][0] .= ” <span class=”update-plugins count-$pending_count”><span class=”plugin-count”>” . number_format_i18n($pending_count) . ‘</span></span>’; endforeach; ..that should avoid the need to know the specific key.. (let me know if any problems).. Hope that … Read more

Modify ‘Read more’ link adding a new class

What (exactly) happens When calling the_content() inside your template, you are able to call it without any parameters. This means, that the function already has the defaults of null for both arguments: The “more” link text and the boolean switch that allows you to strip teaser content before the “more” link text. The the_content() function … Read more

How to add a button to custom post type’s posts-page

You can add button via add_meta_box function. function add_your_meta_box(){ add_meta_box(‘your-metabox-id’, ‘Title’, ‘function_of_metabox’, ‘custom_post_type’, ‘side’, ‘high’);} add_action(‘add_meta_boxes’, ‘add_your_meta_box’); function function_of_metabox() {?> <input type=”submit” class=”button button-primary button-large” value=”Add New” id=”add-new”/> <?php } if you add to multiple post type, you should use foreach loop. function add_your_meta_box(){ $types = array(“post”,”page”,”custom_post_type”); foreach($types as $type){ add_meta_box(‘your-metabox-id’, ‘Title’, ‘function_of_metabox’, $type, ‘side’, … Read more

How do I detach images from posts?

If you view the Media Library in the list mode: /wp-admin/upload.php?mode=list then you will see the Attach/Detach links for each attachment. Each attachment can only be attached to a single parent through the post_parent field in the wp_posst table. Deleting an image from the post editor will not change the post_parent field to 0. Making … Read more

Pre-fill fields with content from outside when creating a new post

An empty post is created by get_default_post_to_edit(). This function reads the post_title, content and excerpt values in the $_REQUEST array, and also filters them through default_title, default_content and default_excerpt. By default this function only returns a “fake” $post object, but if the $create_in_db parameter is set to true, it is actually saved in the database … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)