Created
April 9, 2021 12:36
-
-
Save msaari/016cb1ccb7df21af9ca254a94d6b45b5 to your computer and use it in GitHub Desktop.
Base64 decoding code block content
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
<?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