/** * Change the WP Page Template to Elementor Canvas with Post ID. */ function jkit_change_post_template() { /** * Please enter the Post ID you want to change its Page Template to Elementor Canvas. */ $post_template_id = array( 11, 26 ); /** The Example is 11 and 26 */ foreach ( $post_template_id as $id ) { $page_template = get_post_meta( $id, '_wp_page_template', true ); $search_key = 'elementor_'; if ( strpos( $page_template, $search_key ) === false ) { update_post_meta( $id, '_wp_page_template', 'elementor_canvas' ); } } } add_action( 'init', 'jkit_change_post_template' );