You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Retrieve the custom data
$post_id = $item->get_value( 'post_id' );
// Return WP_Error if the item processing failed (In our case we simply skip author with user id 5)
// if ( $post_id != 5 ) {
// return new WP_Error( 302, "ID".$post_id );
// }
// Do the expensive processing here. eg. Sending email.
// ...
**wp_trash_post($post_id);**
// Return true if the item processing is successful.
return true;
}
/**
* Called when specific process is finished (all items were processed).
* This method can be overriden in the process class.
* @return void
*/
public function finish() {
// Do something after process is finished.
// You have $this->items, or other data you can set.
}
}
The text was updated successfully, but these errors were encountered:
I have been having this issue too. I am updating ~3000 posts, only if they do not have a certain meta value. Once they are updated that meta value is added. When it updates the Total # goes down.
Problem is that every time it runs to update the number processed it runs the setup method again and the query again which then updates the total number. The % then takes the Processed # / Total # to get the % complete. It does what it's supposed to do, but the visual feedback is then incorrect.
I guess the fix, be it when you are creating the batch, or something the author of the plugin adds, is to make sure whatever query you run in setup is only ran once and saved.
Hi,
I am trying with simple delete post like this, but the batch keep running even reach 100%...
Please check that...!
public function setup() {
public function process( $item ) {
The text was updated successfully, but these errors were encountered: