Adding custom styles to dropdown in editor

You can add this code to your functions.php function add_style_select_buttons( $buttons ) { array_unshift( $buttons, ‘styleselect’ ); return $buttons; } // Register our callback to the appropriate filter add_filter( ‘mce_buttons_2’, ‘add_style_select_buttons’ ); //add custom styles to the WordPress editor function my_custom_styles( $init_array ) { $style_formats = array( // These are the custom styles array( ‘title’ … Read more

Admin search not working for any type of post

you can try writing something that appends to your query var when the search is initiated something as such as: function gt_search_filter($query) { global $wp_query; if ($query->is_search) if($_REQUEST[‘s’]){ $wp_query->query_vars[‘s’] = $_REQUEST[‘s’]; } return $query; } add_filter(‘pre_get_posts’,’gt_search_filter’); this worked for me but remember this is quite insecure and not advised what other thing you can do … Read more

Can’t extend some core classes

You can extend it, but the class definition and any code that uses it, can’t run outside of the admin area. Wrap your class in this conditional: if ( is_admin() ) { … } If you are trying to use this on the frontend or other non-Admin areas, do not do that. Generally, classes WordPress … Read more

Stopping user deletion from running on error

After the discussion with @CelsoBessa in the comments section of the question, I came up with this solution function display_admin_notices () { // NOTE: Maybe code should be added here to ensure you are displaying those notices only for certain admin pages if (isset($_GET[‘update’])) { switch ($_GET[‘update’]) { case NOTICE__ERROR: $type=”notice-error”; break; case NOTICE__WARNING: $type=”notice-warning”; … Read more