register_post_type name character limit

You cannot change that value. The database schema is limited to 20 Bytes. See wp-admin/includes/schema.php: TABLE $wpdb->posts ( ID bigint(20) unsigned NOT NULL auto_increment, post_author bigint(20) unsigned NOT NULL default ‘0’, post_date datetime NOT NULL default ‘0000-00-00 00:00:00’, post_date_gmt datetime NOT NULL default ‘0000-00-00 00:00:00’, post_content longtext NOT NULL, post_title text NOT NULL, post_excerpt text … Read more

Add Standard Page Attributes Metabox for Page Parent

Although not listed in the following resources, seems that parent_id is a reserved name in $_POST and $_REQUEST: Function_Reference/register_taxonomy#Reserved_Terms List of reserved names in $_POST and $_REQUEST used by WordPress 3.5 This code works in a Woocommerce product page to show a dropdown of regular pages. Also, in your code, you were missing the get_post_meta … Read more

get_category_parents for custom post type taxonomy

Updated answer: There’s now a core function since WordPress 4.8, to list the ancestors of a given term: get_term_parents_list( int $term_id, string $taxonomy, string|array $args = array() ) and get_category_parents() is a wrapper for that function with $taxonomy as ‘category’. Previous answer: Here is a modified version I made from the function get_category_parents() to support … Read more

Roles for Custom Post Types

I’m sure you could specify some capabilities while registering the Post Type itself. Although, here is a more robust version that can be used widely across the administration dashboard. /** * Hide dashboard administrator menus from disallowed user roles. * * @author Michael Ecklund * @author_url https://www.michaelbrentecklund.com/ * * @return void */ function mbe_hide_menus() { … Read more

Allow user to set custom order to a list of custom taxonomies?

For those interested I figured it out. I added this to my functions.php: function set_the_terms_in_order ( $terms, $id, $taxonomy ) { $terms = wp_cache_get( $id, “{$taxonomy}_relationships_sorted” ); if ( false === $terms ) { $terms = wp_get_object_terms( $id, $taxonomy, array( ‘orderby’ => ‘term_order’ ) ); wp_cache_add($id, $terms, $taxonomy . ‘_relationships_sorted’); } return $terms; } add_filter( … Read more