How to get the Tags on Publish post hook?

Found Solution : If there is no data in the request_body, the we can also fetch it from the postID which is already we have. Changed Code: added condition if data not available, then get it from post id public static function saveDataInNotificationTable($ID,$request_body) { $post_data = json_decode($request_body); $tags = $post_data->tags; if($post_data == “” || $post_data … Read more

Include drafts in internal link dialog

This is very similar to this question. We have to hook into check_ajax_referer to address the internal linking feature only. Then we register an action for pre_get_posts to extend the search to drafts and pending posts. We will still get no pretty permalinks, because they are excluded in get_permalink. So we register a filter for … Read more

Clicking On View Post In Draft Opens New Tab

You can hack by adding below lines in your theme’s functions.php file. function remove_preview_target() { // below JS code will set Preview button’s **target** attribute to **_self**, it means same tab/window. echo “<script> jQuery(document).ready(function(){ jQuery(‘#post-preview’).attr(‘target’, ‘_self’); }) </script>”; } // this action performs in admit footer add_action(‘admin_footer’, ‘remove_preview_target’); Or add below lines in your JS … Read more

save imported posts as drafts

You can hack this plugin code by changing ‘create_draft‘ option ‘no’ to ‘yes’ into plugin.php ‘get_default_import_options‘ method(Approx line no. 1013). I’m not tested this hack, try it your own risk.

Dashboard :10 Last draft page and 10 last pending review page (metabox)

#dahsboard BOXES #Last edited pages add_action( ‘wp_dashboard_setup’, ‘admin_dashboard_last_edits_register’ ); function admin_dashboard_last_edits_register() { wp_add_dashboard_widget( __FUNCTION__, __( ‘Last published pages ‘, ‘admin-dashboard-last-edits’ ), ‘admin_dashboard_last_edits_dashboard_widget’); } function admin_dashboard_last_edits_dashboard_widget() { $posts = get_posts( array ( ‘numberposts’ => 10, ‘post_type’ => array ( ‘page’ ), ‘orderby’ => ‘modified’) ); if ( $posts ) { $date_format = get_option( ‘date_format’ ); echo … Read more