Skip to content

Instantly share code, notes, and snippets.

@sc0ttkclark
Last active May 1, 2025 16:27
Show Gist options
  • Select an option

  • Save sc0ttkclark/35a15e6f93622c45f12d671184fb1315 to your computer and use it in GitHub Desktop.

Select an option

Save sc0ttkclark/35a15e6f93622c45f12d671184fb1315 to your computer and use it in GitHub Desktop.

Revisions

  1. sc0ttkclark revised this gist May 1, 2025. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions pods-eval.php
    Original file line number Diff line number Diff line change
    @@ -34,3 +34,8 @@
    eval( '?>' . $code );
    }
    }, 10, 3 );

    /**
    * Don't show errors about having PHP code in Pods screens.
    */
    add_filter( 'pods_eval_show_errors', '__return_false' );
  2. sc0ttkclark created this gist May 1, 2025.
    36 changes: 36 additions & 0 deletions pods-eval.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    <?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 );