How to add and clear custom post types and taxonomies in a plugin? Considerations for existing data

Custom post types and taxonomies can be registered using register_post_type() and register_taxonomy(). These functions do not actually create any data in the database. Data is added when users populate content (posts and taxonomies). When a plugin is disabled, any post types and taxonomies that it registers will be unregistered, but all of their data in … Read more

Issues with a WP plugin menu system

This function is still open! Add “}” at the end. function register_submenu_page() { add_submenu_page( ‘broughton-admin-page’, ‘Upload XML’, ‘Upload XML’, ‘manage_options’, ‘upload-xml-page’, ‘upload_xml_page’ ); add_submenu_page( ‘broughton-admin-page’, ‘Archive XML’, ‘Archive XML’, ‘manage_options’, ‘archive-xml-page’, ‘archive_xml_page’ ); }

What does -> mean in WordPress?

NO -> is not wordpress specific, it is object operator in php. When you want to call a method of an instance then you call the method with -> Class SomeClass{ function example(){ return ‘This is an example function’ } } $obj = new SomeClass(); $obj->example(); // we are calling example function with -> operator … Read more

Odd map_meta_cap $args on post edit — sometimes integer, sometimes string

The map_meta_cap function handles context arguments generically – you can give it anything and it’ll happily pass it down the chain. It’s only particular capabilities like edit_post that expect the argument to be an integer, but even then it’s up to the caller to pass an appropriate value. Here’s where you get your string/integer mashups … Read more