Skip to content

Instantly share code, notes, and snippets.

@msaari
Created April 9, 2021 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msaari/016cb1ccb7df21af9ca254a94d6b45b5 to your computer and use it in GitHub Desktop.
Save msaari/016cb1ccb7df21af9ca254a94d6b45b5 to your computer and use it in GitHub Desktop.
Base64 decoding code block content
<?php
add_filter( 'relevanssi_oxygen_section_content', function( $content ) {
if ( preg_match_all( '/\[ct_code_block.*?ct_code_block\]/', $content, $matches ) ) {
foreach ( $matches[0] as $match ) {
if ( preg_match_all( '/"code-php":"(.*?)"/', $match, $block_matches ) ) {
foreach ( $block_matches[1] as $encoded_text ) {
$content .= base64_decode( $encoded_text );
}
}
}
}
return $content;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment