Gutenberg Block manipulation: Undo parse_blocks() with serialize_blocks() results in unicode issues

I would like to manipulate Gutenberg Blocks with PHP. Therefore I need to parse post_content into an array and the same way back after manipulation. But I don’t get that far, because already the parsing back and forth doesn’t work. function change_post_data_before_save( $data, $postarr ) { $post_data = $data[‘post_content’]; //post_content seems to be json encoded … Read more

How to parse wordpress options json

I have the data saved using a plugin in this format: a:7:{s:6:’Sunday ‘;a:3:{s:6:’active ‘;s:3:’yes ‘;s:5:’start ‘;s:5:’08: 00 ‘;s:3:’end ‘;s:5:’13: 00 ‘;} s:6:’Monday ‘;a:3:{s:6:’active ‘;s:3:’yes ‘;s:5:’start ‘;s:5:’08: 00 ‘;s:3:’ end ‘;s:5:’17: 00 ‘;} s:7:’Tuesday ‘;a:3:{s:6:’ active ‘;s:3:’yes ‘;s:5:’start ‘;s:5:’08: 00 ‘;s:3:’end ‘;s:5:’17: 00 ‘;} s:9:’Wednesday ‘;a:3:{s:6:’active ‘;s:3:’yes ‘;s:5:’start ‘;s:5:’08: 00 ‘;s:3:’end ‘;s:5:’17: 00 ‘;} s:8:’Thursday ‘;a:3:{s:6:’active … Read more

How to remove “http://” When Echoing URL?

I’m seeking to echo the domain name (url) without the ‘http://’ (or ‘https://’). I’ve created the following: <?php $surl = bloginfo(‘url’); $findh = array( ‘http://’ ); $replace=””; $outputh = str_replace( $findh, $replace, $surl ); echo $outputh; ?> also another one (of many) I tried: <?php $surl = bloginfo(‘url’); echo str_replace(‘http://’, ”, $surl); ?> Seems like … Read more

Correct regex for wp_embed_register_handler

THE GOAL I’m trying to parse a url and convert it to an embedded video player in my post’s content but I think my regEx is off or I’m not creating a provider correctly. THE CODE Here is what I have setup now. wp_embed_register_handler(‘brightcove’, ‘/(players.brightcove.net/)([^/]+)/([^/]+)/index\.html\?videoId=([\d]+)/g’, ‘wp_embed_handler_brightcove’); function wp_embed_handler_brightcove($matches, $attr, $url, $rawattr) { // var_dump($matches, $attr, … Read more