Setting dirty on customizer
Just set the saved state to false: wp.customize.bind( ‘ready’, function() { wp.customize.state( ‘saved’ ).set( false ); } );
Just set the saved state to false: wp.customize.bind( ‘ready’, function() { wp.customize.state( ‘saved’ ).set( false ); } );
Without seeing your specific situation, I cannot say whether this is what’s causing your issues or not, but this is my best guess. WordPress has this cool thing called the Heartbeat API. It pings the server periodically while you’re logged in and in the WordPress admin. It does a number of things to help improve … Read more
The hook that you’re currently using is publish_<post type> which means the <post type> part is dynamic and the value is a post type name/slug. So for other post types like page and (a custom post type named) my_cpt, you would just need to change the “post” (or the <post type> part) in the hook … Read more
There are a number of hooks you can use, such as publish_post or save_post, e.g.: // an example of a post save hook add_action( ‘save_post’, ‘diligents_post_save_hook’ ); function diligents_post_save_hook( $post_id ) { //verify post is not a revision if ( !wp_is_post_revision( $post_id ) ) { // do things } } save_post will fire on publish … Read more
I am not sure if I get your question right, and thus don’t know if this answer goes into the right direction… Is this what you’re trying to achive? $apart_locations = $wpdb->get_col( “SELECT meta_value FROM $wpdb->postmeta AS wppm LEFT JOIN $wpdb->posts AS wpp ON wppm.post_id = wpp.ID WHERE wppm.meta_key = ‘postal_location’ AND wpp.post_status=”publish” ORDER BY … Read more
What does the content of theme name/include/widget.php ? The error is pointing to line 1 and telling you it did not expect to see ?> there. My guess (without seeing the file) is you have closed a php tag instead of opened it.
I am sure there’s an easier way to accomplish this, but this how I would’ve done. Query all posts with category X and status X Update query results with status Y. $target_category = ‘news’; $change_status_from = ‘draft’; $change_status_to = ‘publish’; $update_query = new WP_Query(array(‘post_status’=>$change_status_from, ‘category_name’=>$target_category, ‘posts_per_page’=>-1)); if($update_query->have_posts()){ while($update_query->have_posts()){ $update_query->the_post(); wp_update_post(array(‘ID’=>$post->ID, ‘post_status’=>$change_status_to)); } } You can … Read more
author’s name or logged in user’s name? can use global $current_user; or wp_get_current_user(); if the user is logged in. if( is_user_logged_in() ) { $current_user = wp_get_current_user(); echo $current_user->user_firstname; } for specific user role you can check $current_user->roles array. Reference: https://codex.wordpress.org/Function_Reference/wp_get_current_user https://codex.wordpress.org/Function_Reference/get_currentuserinfo
From the the_date() documentation: Will only output the date if the current post’s date is different from the previous one output. i.e. Only one date listing will show per day worth of posts shown in the loop, even if the function is called several times for each post. [Emphasis mine] You’re almost certainly looking for … Read more
You can use the transition_post_status hook, which is fired whenever the status is changed. So to perform an action when the status is changed to publish, you’d do this: function notificationApprove( $new_status, $old_status, $post ) { if ( ‘publish’ === $new_status && ‘publish’ !== $old_status && ‘post’ === $post->post_type ) { // Send mail } … Read more