You appear to be a bot. Output may be restricted
Description
Query the posts to be published or republishedNote: We don't expect there to be so many posts that we can't apply the updates in one invocation. Note: We look for posts in "future" status, even if the post_date is in the past. When $cat is null we look for all posts, even those marked as "_do_not_reschedule". This will enable the admin user to decide what the value of the flag should be? When $cat or $tag is not null then we only reschedule one post.
Usage
$array = oik_batchmove_query_reposts( $post_date, $cat, $tag );
Parameters
- $post_date
- ( string ) required – post_date to be used for the query
- $cat
- ( string ) optional – Category ID – for Category. If not null then we only lists posts without "_do_not_reschedule" The value 0, which is not a valid category, is used by scheduled batchmove when actually performing the move.
- $tag
- ( string ) optional – Tag ID – for the selected tag. If not null then we only lists posts without "_do_not_reschedule"
Returns
array array of posts found that satisfy the queryTO DO
Enhance UI to allow setting of this field.Source
File name: oik-batchmove/admin/oik-batchmove-cron.phpLines:
1 to 34 of 34
function oik_batchmove_query_reposts( $post_date, $cat=null, $tag=null ) { bw_trace2(); oik_require( "includes/bw_posts.php" ); $atts = array(); $atts['post_type'] = "post"; $atts['year'] = bw_format_date( $post_date, "Y" ); $atts['monthnum'] = bw_format_date( $post_date, "n" ); $atts['day' ] = bw_format_date( $post_date, "j" ); $atts['orderby'] = "date"; $atts['order'] = "ASC"; $atts['numberposts'] = -1; $atts['post_status'] = array( 'publish', 'future' ); if ( $cat !== null ) { if ( $cat ) { $atts['cat'] = $cat; $atts['numberposts'] = 1; } $atts['meta_key'] = "_do_not_reschedule"; $atts['meta_compare'] = "NOT EXISTS"; $atts['meta_value'] = "1"; } if ( $tag !== null ) { //if ( $tag ) { $atts['tag_id'] = $tag; $atts['numberposts'] = 1; //} $atts['meta_key'] = "_do_not_reschedule"; $atts['meta_compare'] = "NOT EXISTS"; $atts['meta_value'] = "1"; } $posts = bw_get_posts( $atts ); return( $posts ); }View on GitHub View on Trac