How to restrict on selecting child taxonomy

Really, you could probably refine this more and come up with better names, I just wanted to make it functional ^_^ ! First thing’s first -> Let’s include JQuery because I don’t want to do this in vanilla JS. function lets_include_jquery() { wp_enqueue_script( ‘jquery’ ); } add_action( ‘admin_enqueue_scripts’, ‘lets_include_jquery’ ); Now let’s throw a script … Read more

Create taxonomy with meta term using the WP Rest Api

I think you need an update_callback in register_rest_field(). Please note that I haven’t tested this. add_action( ‘rest_api_init’, ‘slug_register_meta’ ); function slug_register_meta() { register_rest_field( ‘place’, ‘meta’, array( ‘get_callback’ => ‘slug_get_meta’, ‘update_callback’ => ‘slug_update_meta’, ‘schema’ => null, ) ); } function slug_get_meta( $object, $field_name, $request ) { return get_term_meta( $object[ ‘id’ ] ); } function slug_update_meta($value, $object, … Read more

How to return a list of custom taxonomy terms via the Gutenberg getEntityRecords method

The getEntityRecords() method uses the REST API, so make sure the taxonomy is enabled for the REST API. You can enable it via the show_in_rest parameter when registering the taxonomy using register_taxonomy(). With getEntityRecords(), if you set per_page to -1, it will actually be changed to 100, which as you’ve figured it out, is the … Read more

Connect Users and Taxonomies

I came across a tutorial about ‘Custom User Taxonomies in WordPress‘ and there is a plugin based on that ‘User Taxonomies‘ but these are for creating taxonomies for Users. Have a read thought the tutorial it might help. I think what you’re talking about is to associating posts’ taxonomies with users. I think you need … Read more

wp_insert_term auto unique name

EDIT PART DEUX OR PART DEUX – The Dirty Sequal, The Term Saga Continues… Before anyone read this section, I will urge you to read everything I explained in ORIGINAL ANSWER. wp_insert_term() does not allow duplicate term names in non hierarchical taxonomies or in hierarchical taxonomies within the same hierarchy. From comments to my answer, … Read more

Custom taxonomy on users with UI

Answering this question is, by design, a multi-part process. There are several things you (or a plugin/library) need to do to make User Taxonomies behave similarly to Post Taxonomies, even after you have (successfully) registered it. This answer is a work-in-progress to some degree. Please add other answers with solutions to any aspects that are … Read more

term_description help

H1 tags around the descriptions? echo ‘<h1>’ . term_description() . ‘</h1>’; UPDATE: Add link to plugin to allow HTML in term descriptions. WordPress Plugins – Allow HTML in Category Descriptions This will work with custom taxonomies to. http://wordpress.org/extend/plugins/allow-html-in-category-descriptions/ Copy of the appropriate code For those of you that want to simply see how it’s done. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)