Adding a form at the end of the content

If I understand what you are doing, and the problem you are having, the first thing I’d try is to add your the_content filter with a large priority number so that it runs late, and hopefully after the other formatting filters. add_filter(‘the_content’,’your_callback’,100); If that doesn’t do it you may have to remove and reorder some … Read more

Hook for post permalink update

You need to exactly use wp_insert_post_data. This contains array of post data what will be store into database after WordPress has done all of the validation/sanitization. add_filter(‘wp_insert_post_data’, ‘wpse_wp_insert_post_data’, 10, 2); function wpse_wp_insert_post_data($data, $post_attr) { // you get the post_name using $data[‘post_name’]; // post id will not be present for the first insert // but you … Read more

Detect type of post status transition

If not, how do I tie multiple hooks to the same action? Do I just list them like so: add_action(‘new_to_publish’, ‘save_new_post’, 10, 1); add_action(‘future_to_publish’, ‘save_new_post’, 10, 1); add_action(‘draft_to_publish’, ‘save_new_post’, 10, 1); This is exactly the way to go. Just hook the same callback into each of the status-transition hooks on which you want the callback … Read more

add_action on inherit post status

I’m running into this same issue in some code I’m developing. In your case though tree is a better hook as you only want to hook posts that are moving to ‘publish’ You need to hook your function into all of the possible {status}_to_publish hooks like this: add_action(‘new_to_publish’, ‘my_function’); add_action(‘draft_to_publish’, ‘my_function’); add_action(‘auto-draft_to_publish’, ‘my_function’); add_action(‘pending_to_publish’, ‘my_function’); … Read more

Extend Woocommerce rest api routes fails

What if in your register_rest_route() call you can pass it the permission_callback option: ‘permission_callback’ => function () { return current_user_can(‘customer’); // OR return current_user_can(‘shop_manager’); } That way you are sure that you are dealing with a logged in Woocommerce user?? These are the two roles that Woocommerce is adding to your site. https://docs.woocommerce.com/document/roles-capabilities/ I know … Read more

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