A unique wp_schedule_single_event() for each post?

You can pass arguments to the wp_schedule_single_event function: wp_schedule_single_event($newdate, “one_day_before_event”, array($post->ID)); Then if you do an add_action you can say how many arguments it will receive (in this case 1). add_action( ‘one_day_before_event’, ‘some_function’, 10, 1 ); Then in your function you can access the variable: function some_function($post_id) { // Do something with $post_id }

Which hook to add action on specific page?

wp_loaded hook is too early for environment to be completed and for conditionals to work. You need to do this a little later, for example on admin_head hook. PS also use get_the_ID() for cleaner look 🙂

missing argument 2 when passing arguments to add_action

This problem can be met when hooking in whatever hook that has already been triggered by a precedent do_action (ie. when this_hook has already been mentionned in a do_action within the core files of wordpress or within whatever plugin files) In that particular case, demanding arguments when registering a new function within an add_action(‘this_hook’,’function’, $priority, … Read more

Can’t Get Metabox Data Saved Assistance Needed

The save_post hook is the only one you need, also, your callback function is missing a parameter, check this example: /** * Save post metadata when a post is saved. * * @param int $post_id The ID of the post. */ function save_book_meta( $post_id ) { /* * In production code, $slug should be set … Read more

Why does my delete_post hook get called twice

I found my solution. The function you hook into delete_post (or probably any other similar hook) executes as many times as needed. Considering delete_post needs to delete the post and all of its revisions, it will always run more than once. In order to avoid having your function execute each time WordPress deletes a record … Read more

Generate payment URL in custom email [closed]

The correct method for generating a payment URL is: get_checkout_payment_url() So my code changed to to: $payment_page = $order->get_checkout_payment_url(); Which generates the following URL: http://www.example.co.za/checkout/order-pay/[order-number]?pay_for_order=true&key=order_[order-key] Which is what I was looking for. Note that the order status must be set to unpaid or pending in order for the generated link to be valid

Form action unfamiliar

Generally, they will return the same URL, as bloginfo( ‘url’ ) will call home_url internally with any arguments, and the default first argument ($path) of home_url is the empty string. However, bloginfo( ‘url’ ) will apply an additional filter to it, namely the home_url filter. Common pratice is to use home_url, indeed with esc_url (even … Read more

Is dynamic action name building a bad practice?

Usually yes, sometimes no, but in your example, definitely bad practice You see, instead of putting the name or the post ID in the action name, you should have passed it as a parameter instead. Otherwise there is no way to grab all elementor css file parsing, or no way to work after any arbitrary … Read more

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