Show message from backend

The problem is that when a post is saved, there’s a redirect back to the edit post page and the admin_notices action never runs. This means that any admin notice you put on any of the save post actions (save_post, transition_post_status, etc.) will be thrown away (since they’re not persistent) during that redirect. The workaround … Read more

Creating multiple wp_editer() text fields in for loop — the text/visual switch only works for first editor

https://codex.wordpress.org/Function_Reference/wp_editor The second argument for the wp_editor() function is editor ID In the above for loop – all of the editors had the same ID Changing <?php wp_editor( wp_kses_post( $benz_tab_content ), ‘benz_tab_content’, $settings ); ?> to <?php wp_editor( wp_kses_post( $benz_tab_content ), “benz_tab_content_$y”, $settings ); ?> allowed me to give each editor a unique ID — … Read more

WP Enqueue style on all plug-in pages

If you want enqueue style on all admin pages You can use the following code function load_custom_wp_admin_style() { wp_enqueue_style( ‘custom_wp_admin_css’, plugins_url(‘css/style.css’, __FILE__) ); } add_action( ‘admin_enqueue_scripts’, ‘load_custom_wp_admin_style’ ); Or if you want enqueue style on specific pages, You can use the following code function load_custom_wp_admin_style($hook) { if($hook != ‘toplevel_page_myplugin’ || $hook != ‘widgets.php’ || $hook … Read more