edit_{$taxonomy} | Hook

You are getting old version of the term, because edit_{$taxonomy} action is fired after the term is updated but before term’s cache is cleared. Use edited_{$taxonomy} hook, which fires your action after the term is updated and its cache is cleared.

Display content from custom post without modifying the single template

Yes, it’s possible. You’ll need to use the template_include filter. To return a different template for a custom post type of “my_custom_post_type”, you could do something like this: add_filter( ‘template_include’, ‘wpse_272261_template_include’, 100 ); function wpse_272261_template_include( $template ) { if ( is_singular( [ ‘my_custom_post_type’ ] ) ) return PATH_TO . ‘template.php’; return $template; }

Clearing cached plugin data if it is using an external object cache

We note that the Transients API uses the Object Cache API, when we use an object-cache.php drop-in file. For example if wp_using_ext_object_cache() returns true, then get_transient( $transient ) -> wp_cache_get( $transient, ‘transient’ ) set_transient( $transient, $value, $expiration ) -> wp_cache_set( $transient, $value, ‘transient’, $expiration ) delete_transient( $transient ) -> wp_cache_delete( $transient, ‘transient’ ) where the … Read more

wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated

Don’t bother fixing your AJAX callback, there’s already a REST API endpoint that’s well tested and does all of this out of the box: example.com/wp-json/wp/v2/zen_page So lets enqueue a helper script to give us the URL and a security token/nonce: wp_enqueue_script( ‘wp-api’ ); You will must enable the REST API for your custom post type … Read more

Demystifying and understanding shortcode nomenclature

It’s just [link to= “https://wordpress.stackexchange.com/”]. This is a textbook example of why extract() is bad. You can’t easily tell where variables are coming from. extract() creates variables out of an array with the keys becoming the variable name. So this part: extract(shortcode_atts(array( “to” => ‘http://net.tutsplus.com’ ), $atts)); Is creating an array with a to key, … Read more

Why this global array is returning NULL from a callback function

The problem here is that you never created $ppk_fields as a global variable. $ppk_fields = [ ‘field 1’ => [ ‘title’ => ‘Fieald One’, ‘type’ => ‘text’, ‘section’ => ‘section_1’, ‘default’ => ‘default’ ] ]; Here we have a variable that is created normally, and obeys normal scoping rules. It isn’t a global variable, and … Read more

Update Option Error: Notice: Undefined index

This is because when a checkbox isn’t checked it didn’t send to the server. This is why the POST array doesn’t have the upo_enable index. You can, however, check if the value is empty or not: $upo_enable = !empty($_POST[‘upo_enable’]) ? true : false; Or $upo_enable = !empty($_POST[‘upo_enable’]) ? $_POST[‘upo_enable’] : false; More on this: https://www.w3.org/TR/html401/interact/forms.html … Read more