How do_action funtion works with path parameter?

The first argument of do_action is the $tag, a string. As far as the API is concerned, there’s no special meaning to the contents of the $tag, it’s just a unique name that’s matched as a whole to hooked actions of the same name. The structure and naming convention of tags is up to the … Read more

With W3 Total Cache when I publish a post it does not appear in the homepage. Only if i purge all cache [closed]

You are most likely using browser caching ? Therefore new visitors would see the newly published post just fine, but because you’ve previously visited the page its cached and therefore your browser cache hasnt expired. Generally its good practice to clear all caches upon publishing posts/pages and/or activating or deactivating a plugin. You can also … Read more

How I can get custom field’s current value?

The author of plugin help me with that. Thanks all. global $post; $product_colors = get_the_terms( $post, ‘product_color’ ); $saved_colors = get_option( ‘nm_taxonomy_colors’ ); if(isset($product_colors) && is_array($product_colors)){ foreach($product_colors as $color){ $term_id = $color->term_id; $hex_code = $saved_colors[$term_id]; echo $hex_code . ‘<br />’; } }

Change the method of a class from child function.php

In you case i am considering this is direct function attached to shortcode. You can create your own shortcode and use it to display what you want. You can try this hack hope it will help you, add_shortcode( ‘custom-bewpi-download-invoice’, ‘print_invoice_func’); function print_invoice_func( $atts ) { if ( ! isset( $atts[‘order_id’] ) || 0 === intval( … Read more

Unique 4 digit number

For unique 4 digit number, the following code work fine function unique_number($length=10) { $string = ”; // You can define your own characters here. $characters = “0123456789”; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters)-1)]; } return $string; } print unique_number(4); Every plugin has extended capability to change the default … Read more

When to use action hooks and plugins

First of all, see this WordPress Codex page: AJAX in Plugins You don’t technically need to write a plugin to do what you want to do, but it is good practise to do so, especially for the kind of functionality you are building. (Building a database table, handling form data, submitting with AJAX, etc.) Check … Read more