Adding extra pages to plugin that shouldn’t appear in the sidebar

If you need admin pages that don’t appear in the menu, use add_submenu_page and set $parent to null. This will create a functional page that doesn’t get rendered in the menu. add_action( ‘admin_menu’, ‘wpd_hidden_plugin_submenu_page’ ); function wpd_hidden_plugin_submenu_page() { add_submenu_page( null, ‘My Hidden Submenu Page’, ‘My Hidden Submenu Page’, ‘manage_options’, ‘my-hidden-submenu-page’, ‘my_hidden_submenu_page_callback’, ); } Users will … Read more

What user roles should have wp_unique_post_slug_is_bad_flat_slug filter applied?

Actually you should skip the condition altogether – you don’t need to worry about permissions or context here, you are merely saying: If WordPress, for whatever reason, is determining if a slug is bad: run my additional conditions Currently, if a theme/front-end plugin/REST API call was triggering the filter (i.e. insert/updating a post), your checks … Read more

Are we allowed to use the Allman (BSD) indent style when coding WordPress plugins and themes?

WordPress.org does not have any hard requirements for code styles for plugins or themes. In the plugin guidelines, the relevant section is #4, “Keep your code (mostly) human readable.” Mainly it is about obfuscation. The most relevant line is this: We recommend following WordPress Core Coding Standards. Note the word recommend, there. This is not … Read more

Creating a Wordpess Plugin that writes data to a csv file. The data doesn’t show in the csv file?

Your WordPress code is correct, the problem is the incorrect 2nd param to PHP’s frwite(), which needs to be a string, and you’re passing arrays. I think you want something like: fwrite ($fp, “$label\n”) ; fwrite ($fp, implode (‘,’, array_keys ($entries)) . “\n”) ; fwrite ($fp, implode (‘,’, array_values ($entries)) . “\n”) ;