LLMS_Blocks_Migrate::migrate_post()

Migrate posts created prior to the block editor to have default LifterLMS templates


Description Description


Return Return

(void)


Top ↑

Source Source

File: vendor/lifterlms/lifterlms-blocks/includes/class-llms-blocks-migrate.php

	public function migrate_post() {

		global $pagenow, $post;

		if ( 'post.php' !== $pagenow || ! is_object( $post ) ) {
			return;
		}

		if ( ! $this->should_migrate_post( $post->ID ) ) {
			return;
		}

		// Already Has blocks.
		if ( has_blocks( $post->post_content ) ) {
			$this->update_migration_status( $post->ID );
			return;
		}

		$this->add_template_to_post( $post );

		// Reload.
		wp_safe_redirect(
			add_query_arg(
				array(
					'post'   => $post->ID,
					'action' => 'edit',
				),
				admin_url( 'post.php' )
			)
		);
		exit;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.4.0 Moves content updating methods to it's own function.
1.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: