Is there a before_save_post hook or something similar
There is a hook called transition_post_status which runs at every transition. You have both the old and new status available inside the hook.
There is a hook called transition_post_status which runs at every transition. You have both the old and new status available inside the hook.
Those first 2 actions you linked to from the codex, user_register and profile_update should be exactly what you need. user_register runs right after a user has successfully registered and gives you access to their $user_id which you can use to retrieve any user data you need, like name, email, etc. add_action( ‘user_register’, ‘wse_custom_register_action’, 10, 1 … Read more
So what you want is to use MySQL’s “ORDER BY” feature: SELECT Treatment FROM my_table WHERE Used=0 ORDER BY Allocation_number ASC LIMIT 1 So you look for all rows where Used=0, order (sort) them by Allocation_number in ascending order, and then pick the first row that matches. (“LIMIT 1”) I’ll let you plug this into … Read more
There is method on product class that is called is_on_sale() which actually determines if the product is on sale or not. You can access it from global $product variable. And must echo the do_shortcode. So the whole code will be like- add_action(‘woocommerce_single_product_summary’,’add_product_signup’, 10, 2); function add_product_signup() { global $product; if( $product->is_on_sale() ) { echo do_shortcode(‘[contact-form-7 … Read more
This will work. It will add a meta box below the content editor window which outputs anything you put in the get_preview_image() function. I’ve included the $post argument so you can grab info from the post. If you need this to be on a custom post type instead of posts, edit where it says ‘post’ … Read more
Here’s one way, out of many, where we use the the_content filter and loop through the get_attached_media( $type ) to construct the list of attached media. We can e.g. use $type=”image” for images or $type = null for all mime types. add_filter( ‘the_content’, function( $content ) { // Nothing to do – target single posts … Read more
You can use this Plugin ! It supports following features for Hooks Shows all hooks fired on the current request, along with hooked actions, their priorities, and their components Filter hooks by part of their name Filter actions by component (WordPress core, Plugin X, Plugin Y, theme) https://github.com/johnbillion/query-monitor
I have investigated this problem and recognized that it is not the TinyMCE fault, but the issue is caused by the the hook function wpautop instead. And tags are wrapped just before post is being displayed. So in order to fix this issue just remove the hook function like that. remove_filter( ‘the_content’, ‘wpautop’ ); This … Read more
Don’t what you want to do but here is something that I did earlier on editor page of post type. function wpb_change_title_text( $title ){ $screen = get_current_screen(); if ( ‘post’ == $screen->post_type ) { //Specify post type $title=”New Placeholder text will come here “; //Enter new placeholder text } return $title; } add_filter( ‘enter_title_here’, ‘wpb_change_title_text’ … Read more
Ok, so i tried this and it worked as expected, i replaced the above code (used in comment.php) with the one bellow. To correct this issue i simply checked if the user is logged in using is_user_logged_in() and then added the comment field to the $comments_args. <?php $comments_args = array( ‘id_form’ => ‘comment-form’, ‘class_form’ => … Read more