Created
June 30, 2021 17:43
-
-
Save lynt-smitka/d00edb1c5d6f87ff57bd61ee5ff73de8 to your computer and use it in GitHub Desktop.
Oxygen - shortcode render
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lynt_save_oxygen( $meta_id, $object_id, $meta_key, $meta_value ) { | |
if ( 'ct_builder_shortcodes' !== $meta_key ) return; | |
$post = get_post( $object_id ); | |
if ( 'page' !== $post->post_type ) return; | |
$content = "<!-- wp:html -->\n" . do_shortcode( $meta_value ) . "\n<!-- /wp:html -->"; | |
$postarr = [ | |
'ID' => $post->ID, | |
'post_content' => $content | |
]; | |
wp_update_post( $postarr ); | |
} | |
add_action( 'updated_postmeta', 'lynt_save_oxygen', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment