Am I using the right hook for removing quicktags on the admin TinyMCE?

After checking out the code, the best way to do this would be to use the wp_editor_settings filter in /wp-includes/class-wp-editor.php. When you call wp_editor() it internally makes a call to _WP_Editors::editor($content, $editor_id, $settings);. This function first passes the $settings array through parse_settings() which uses that filter. add_filter( ‘wp_editor_settings’, ‘remove_editor_quicktags’, 10, 2 ); function remove_editor_quicktags( $settings, … Read more

Is there a hook that fires before an ajax call?

If you look into this file wp-admin/admin-ajax.php where the wp_ajax_ actions are called, you will find that the admin_init action is being called before it. Here is how to return a different json object based on if the user is admin or not: add_action( ‘wp_ajax_testing’, ‘my_ajax’ ); add_action( ‘admin_init’, ‘my_ajax_checker’, 10, 2); function my_ajax_checker() { … Read more

How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’

Updated: First, you will need to return a bool value on your notifications method so we can reliably set a marker for the message method. Then, you will need to set a $_POST array element to pass on to the redirection filter. public function save_post($post_id){ //Add a $_POST key if you syndicated successfully if($this->send_group_notifications()) //return … Read more

Increment Page Order As Pages Are Created

The following is a possible solution, but needs some testing to confirm it is viable. It runs only if menu_order == 0 and if it’s not an auto-draft or revision being saved add_action( ‘save_post’, ‘incremental_save_wpse_113767’, 10, 2 ); function incremental_save_wpse_113767( $post_id, $post_object ) { if( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if( defined( ‘DOING_AJAX’ … Read more