Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Abstract_Upgrade_Posts::process_step()

Executes a single step in the batch process.


Description Description


Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Return Return

(int|string|WP_Error) Next step number, 'done', or a WP_Error object.


Top ↑

Source Source

File: classes/Abstract/Upgrade/Posts.php

	public function process_step() {
		$completed_post_ids = $this->get_completed_post_ids();

		if ( $this->prefetch_ids ) {
			$all_posts = $this->get_post_ids();
			$remaining_post_ids = array_diff( $all_posts, $completed_post_ids );
			$posts = array_slice( $remaining_post_ids, 0, $this->per_step );
		} else {
			$posts = $this->get_posts( array(
				'fields'         => 'ids',
				'posts_per_page' => $this->per_step,
				'offset'         => $this->get_offset(),
				'orderby'        => 'ID',
				'order'          => 'ASC',
			) );
		}

		if ( empty( $posts ) ) {
			return 'done';
		}

		foreach ( $posts as $post_id ) {
			$this->process_post( $post_id );
			$completed_post_ids[] = $post_id;
		}

		// Deduplicate.
		$completed_post_ids = wp_parse_id_list( $completed_post_ids );
		$this->set_completed_post_ids( $completed_post_ids );

		$this->set_current_count( count( $completed_post_ids ) );

		return ++ $this->step;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.