Hiding Specific Terms When Creating or Editing Posts

The WordPress block editor uses the REST API to manipulate all information in the post object, so hiding terms from the category, tags, or a custom taxonomy meta box can be achieved by removing those terms from REST API responses. One hook that makes this easy is the rest_{taxonomy}_collection_params filter. Here is an example that… Continue reading Hiding Specific Terms When Creating or Editing Posts

Published
Categorized as WordPress

WordPress Memes

This is the collection of all the WordPress memes I’ve created. You Should Make Plugins Is This a PHP File? But Her Editors

Published
Categorized as WordPress

Using register_setting() and the REST API

Here is a comment I just requested be added to the bottom of the register_setting() page. If you plan to use your setting in the REST API, use both the rest_api_init and admin_init hooks when calling register_setting() instead of just admin_init. The show_in_rest argument is ineffective when hooked into admin_init alone. Corey Salzano Someday, when my comment is approved, you’ll be able to see it on… Continue reading Using register_setting() and the REST API

Published
Categorized as WordPress

Editing Terms & Term Meta with the WordPress REST API

Here are some JavaScript snippets to manipulate WP_Term objects in WordPress using the REST API and the Backbone JavaScript client library. Insert a term Delete a term This next example assumes you’ve used wp_localize_script() to make the REST API endpoint and a nonce available in an object myplugin. If you need help doing this, please… Continue reading Editing Terms & Term Meta with the WordPress REST API

Published
Categorized as WordPress

Disable tooltips on The Events Calendar month view

Here is a file you could save in wp-content/your-theme/tribe-events/month/content.php that will disable tooltips on the month view calendar produced by The Events Calendar plugin. This is a template override for the month view that adds a few lines of JavaScript to remove some event handlers, and it removes a call loading the tooltip template. The… Continue reading Disable tooltips on The Events Calendar month view

Published
Categorized as WordPress

What is $posted_data passed to Contact Form 7’s wpcf7_posted_data hook

For a ContactForm7 form that has this source: <div class=”wpcf7-lead-widget”>[text* contact-name maxlength:50 placeholder “Your Name (required)”] [email* email maxlength:50 placeholder “Email (required)”] [text phone maxlength:15 placeholder “Phone”] [vehicle_form_field] [textarea comments x3 placeholder “Questions and Comments”] [submit class:_button class:_button-small “Check Availability”] [hidden context id:context “contact”] [hidden do-not-send-mail]</div> The $posted_data that is passed via the wpcf7_posted_data hook… Continue reading What is $posted_data passed to Contact Form 7’s wpcf7_posted_data hook

Published
Categorized as WordPress