Create a Page via plugin

You can create the page via wp_insert_post( $post, $wp_error );. The array $post contains the data for your page, with the full documentation here. Be sure to receive the ID from your inserted page/post. You can Add the page at the activation of your plugin, but please check first if the option for the page … Read more

Tips for targeting widget dragable for WP Pointer on widgets.php page

Since the Feature Me widget in the Available Widgets list, is wrapped into something like this: <div id=”widget-5_feature_me-__i__”>…</div> I then wonder if the following would work (untested): ‘target’ => “div[id$=’_feature_me-__i__’]”, to target all div elements with id’s that end with _feature_me-__i__. I think there should only be a single match, at most, if this works.

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

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”) ;