Create post revision on slug change

If you’re comfortable with PHP, it would be possible to keep track of when the slug is updated. The only way I can think of is a bit complicated: Make sure revisions are enabled, both for your install and for the post type you’re targeting. You’ll have to determine how many revisions you want to … Read more

cannot filter after using pre_get_posts

The problem is that you always set the meta query, if you don’t want it to apply in a particular situation, you need to check for that situation and account for it. Similar to how you’re already checking with is_admin, or is_main_query, etc. In this situation, you’ll want to check the $_GET parameters to detect … Read more

Gravity Forms parameters return 1

It’s not Gravity Forms, it’s ob_end_clean(), which just deletes the buffer and returns a boolean value. (In this case, true, which is getting expressed as 1.) Is there a pressing reason to use the ob_* functions? The code would be more readable (and predictable) if it was something like this. public function collectGFData($entry, $form ) … Read more

How to find where an action is triggered? [closed]

In WooCommerce (my version v6.1.1) there is a file called /woocommerce/templates/checkout/thankyou.php and in line 79 you have trigger with dynamic payment method name so there is a place when each payment method do their magic <?php do_action( ‘woocommerce_thankyou_’ . $order->get_payment_method(), $order->get_id() ); ?> And answering your questions: The opposite. Where is add_action there is a … Read more

Call do_action class’s function

No, you can’t. add_action( ‘hook’, array( [class], “method_name” ) ); is the right way to use a method as callback. Read about how to use methods as callback in the codex. If you want to use a static method as callback, do it in this way: add_action( ‘hook’, array( “ClassName”, “method_name” ) );

add_action on a specific page

In your theme’s functions.php file, or the like: add_action( ‘your-custom-action’, ‘wpse8170_media_popup_init’ ); In the page template used for the page in question: do_action( ‘your-custom-action’ );

Add “add to cart” button in WooCommerce [closed]

You’re right about not doing this inside the theme file, also you have the right thing in mind putting this into your functions.php. Try the approach shown below, it’s more you actually need, so pick what’s fitting in your case. Code: //remove add to cart buttons add_action( ‘init’, ‘wpse124288_wc_remove_add_to_cart_buttons’ ); function wpse124288_wc_remove_add_to_cart_buttons() { //add to … Read more

Content won’t load when using action the_content

the_content is not an action, it is a filter. You should be concatenating a string and returning it. It sounds like you are echoing content directly. That is: // wrong function test_content($content) { echo ‘this is wrong’; } add_filter(‘the_content’,’test_content’); // right function test_content($content) { return ‘this is right ‘.$content; } add_filter(‘the_content’,’test_content’);

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