Last active
May 1, 2025 16:27
-
-
Save sc0ttkclark/35a15e6f93622c45f12d671184fb1315 to your computer and use it in GitHub Desktop.
For Pods 3.3 -- Allow PHP eval for various areas of Pods that was deprecated in Pods 2.1-2.3 and finally removed in Pods 3.3
This file contains hidden or 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 | |
/** | |
* Allow PHP eval for various areas of Pods that was deprecated in Pods 2.1-2.3 and finally removed in Pods 3.3 | |
* | |
* You should avoid using this and start migrating to the recommended solutions: | |
* | |
* Pod Pages - https://docs.pods.io/displaying-pods/pod-page-template-hierarchy-for-themes/ | |
* Pod Templates - https://docs.pods.io/displaying-pods/pod-template-hierarchy-for-themes/ | |
*/ | |
/** | |
* Pods Pages precode eval. | |
*/ | |
add_action( 'pods_page_precode', static function ( $pods_page, $pods, $content ) { | |
if ( false !== strpos( $content, '<?' ) ) { | |
eval( '?>' . $content ); | |
} | |
}, 10, 3 ); | |
/** | |
* Pods Pages content eval. | |
*/ | |
add_action( 'pods_pages_eval_content', static function ( $pods_page, $pods, $content ) { | |
if ( false !== strpos( $content, '<?' ) ) { | |
eval( '?>' . $content ); | |
} | |
}, 10, 3 ); | |
/** | |
* Pods Templates content eval. | |
*/ | |
add_action( 'pods_templates_eval_content', static function ( $code, $obj, $process_php ) { | |
if ( $process_php && false !== strpos( $code, '<?' ) ) { | |
eval( '?>' . $code ); | |
} | |
}, 10, 3 ); | |
/** | |
* Don't show errors about having PHP code in Pods screens. | |
*/ | |
add_filter( 'pods_eval_show_errors', '__return_false' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment