Show Last Revision Of Post That Has A Published Status On Single Page
Show Last Revision Of Post That Has A Published Status On Single Page
Show Last Revision Of Post That Has A Published Status On Single Page
There is a syntax error in the add_action(). You’ve used a period . instead of a comma , to separate the action and the callback. Otherwise the callback seems to work as expected when I tested it locally. The correct syntax would be, add_action( ‘pending_to_publish’, ‘my_function’, 10, 1 ); When doing development work with WordPress … Read more
How to Add Custom Post Status in WordPress Admin
Manually adding or updating CPT automatically sets post_status of future
You can use AND and OR statements in MySQL. Try this: $count = $wpdb->get_var( “SELECT COUNT(*) FROM $wpdb->posts $where AND (post_status=”publish” OR post_status=”draft”)” );
You could use get_post_status(): function is_trash( $post_id = 0 ) { 0 == $post_id and $post_id = get_the_ID(); return ‘trash’ === get_post_status( $post_id ); } Side note: To get a list of all registered post status objects use get_post_stati() – yes, that’s wrong.
What you could do is create a metabox for the ‘People’ custom post type which would have radio values ‘Not Sponsored’ and ‘Sponsored’ (Not Sponsored b default). PayPal posts some transaction details to the notify url you have specified. Once you recieve the proper information from PayPal, like payment status is completed, then you could … Read more
You must write a small plugin for the Hook pre_get_posts; an example: add_action( ‘pre_get_posts’, ‘fb_allow_draft’ ); function fb_allow_draft( $query_obj ) { // only on admin screen use this filter if( ! is_admin() ) return; // change our query object to include any post status $query_obj->query_vars[‘post_status’] = ‘any’; } If you will specific this new loop … Read more
Use get_posts function with WP_Query params instead of get_children. The code will than look like this: $today = getdate(); $pages = get_posts( array( ‘post_status’ => array( ‘publish’, ‘future’ ), ‘post_type’ => ‘event’, ‘sort_order’ => ‘ASC’, ‘orderby’ => ‘date’, ‘year’ => $today[“year”], ‘monthnum’ => $today[“mon”], ‘day’ => $today[“mday”] ) ); foreach ( $pages as $post ) … Read more
Easy native SQL query: global $wpdb; $sql = <<<SQL SELECT post_status, COUNT( * ) AS count FROM {$wpdb->posts} WHERE post_status=”pending” SQL; $result = $wpdb->get_results( $sql ); The result will be something like + ———– + —– + | post_status | count | + ———– + —– + | pending | 158 | + ———– + … Read more