LLMS_Blocks_Migrate::migrate_post()
Migrate posts created prior to the block editor to have default LifterLMS templates
Return Return
(void)
Source Source
File: libraries/lifterlms-blocks/includes/class-llms-blocks-migrate.php
public function migrate_post() { global $pagenow; if ( 'post.php' !== $pagenow ) { return; } $post_id = llms_filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT ); $post = $post_id ? get_post( $post_id ) : false; if ( ! $post || ! $this->should_migrate_post( $post->ID ) ) { return; } if ( 'llms_membership' === $post->post_type ) { if ( has_block( 'llms/pricing-table', $post->post_content ) ) { $this->update_migration_status( $post->ID ); return; } } elseif ( 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; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.7.0 | Add Membership post type support. Update to handle being triggered by hook current_screen instead of admin_enqueue_scripts . |
1.4.0 | Moves content updating methods to it's own function. |
1.0.0 | Introduced. |