Customizing HTML Editor Quicktags button to open a dialog for choosing insert options

According to the Codex, you can’t do this directly through the API. However, you can do it by using your own quicktags.js file as shown below. function sample_load_admin_scripts() { if ( is_admin() ) { wp_deregister_script(‘quicktags’); wp_register_script(‘quicktags’, (“/path/to/your/quicktags.js”), false, ”, true); } } if (is_admin()) { add_action(‘init’, sample_load_admin_scripts); } Then just add Javascript to do your … Read more

Use category base slug in posts’ permalink

I may be missing some vital detail in the question but here’s what I did to make this work. Settings -> Permalinks Set the permalinks to… /somePrefix/%category%/%postname%/ This will give you the following permalinks… Blog Page – domain.com/somePrefix Category Page – domain.com/somePrefix/currCategory/ Single Page – domain.com/somePrefix/currCategory/singlePost/ If you install some kind of plugin like Yoast … Read more

How can I make it so the Add New Post page has Visibility set to Private by default?

since you’re developing a plug-in, I assume you don’t want to touch any files outside of wp-content/plugins or ../themes for that matter. However, if that’s not the case, follow along: Go to wp-admin/includes/meta-boxes.php and find: $visibility = ‘public’; $visibility_trans = __(‘Public’); Now change it to the obvious: $visibility = ‘private’; $visibility_trans = __(‘Private’); Again, this … Read more

How To Have Two Gutenberg Editors On One Post?

You could add some kind of separator (a separator block?) in Gutenberg, then filter the_content() to check for the separator to display each half, by setting a switch on the first half and detecting it for the second: add_filter(‘the_content’, ‘content_splitter’); function content_splitter($content) { $separator = “<!– wp:core/separator”; $pos = strpos($content, $separator); if ($pos !== false) … Read more

How To Disable (or Remove) “All Posts, Published, and Trash” in Dashboard Posts

The WP_Posts_List_Table class extends WP_List_Table and within the WP_List_Table::views() method we have the following dynamic views filter: /** * Filter the list of available list table views. * * The dynamic portion of the hook name, `$this->screen->id`, refers * to the ID of the current screen, usually a string. * * @since 3.5.0 * * … Read more