Category: WordPress

  • Show Attachments on The Events Calendar

    Out of the box, The Events Calendar plugin for WordPress is amazing and a pleasure to work with as a developer. However, it does not show users Media Library uploads that are attached to event posts. I made a plugin to bring this functionality to the Single Event view, it’s free and open-source, and you […]

  • How to Delete Meta Fields with the WordPress REST API

    As of this writing, it is not possible to delete a meta value using the WordPress REST API. Post meta updates must be communicated while inserting and updating post objects, and the only way to “remove” meta fields is to write blank values over their current values. I wrote a free and open-source plugin to […]

  • 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 […]

  • 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

  • Why Elementor Disobeys is_admin()

    I was surprised to learn that when editing a page using Elementor‘s page builder, is_admin() returns false. The reason for this is that Elementor is loading the page in an <iframe> element as if it were being viewed on the front-end. Use code like this to detect when posts or pages are being edited in […]

  • 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 […]

  • The Events Calendar List Widget Replacement

    I wrote a plugin to customize the Events List widget that ships with Modern Tribe’s The Events Calendar Pro plugin. The widget has an option to hide completely when there are no upcoming events. The alternative displays the dreaded “There are no upcoming events at this time” in an otherwise empty Events List widget. I […]

  • 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 […]

  • 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 […]

  • Migrating a GravityView Without Losing Fields

    Exporting a GravityView and importing it into a different site is easy, and there are official instructions right here. This process works very smoothly when the Gravity Forms and GravityViews on both sites are identical. That’s usually not the world I live in, however. I’m a back-end developer in sites that sometimes have multiple teams […]

  • Sometimes, an array is passed to the get_callback provided to register_rest_field() instead of an object

    When using register_rest_field() to add fields to terms in the WordPress REST API, the $object sent to your get_callback function will be an array instead of an object like the documentation describes. An object will still be passed, sometimes, too. Here is an example of how I work around this problem: function add_api_term_fields() { //location-phone-hours […]

  • How to add an additional webhook to an Elementor Form

    Elementor Pro includes a form builder widget, complete with a webhook to which all form data can be sent and a redirect URL to send users after successful submissions. I have been tasked with adding a second webhook to a form because the first was being used for an integration with Zapier. We need to […]