• Resolved TheAggressive

    (@theaggressive)


    Hello,

    I’m making a php class and im trying to add_action to some scripts but when I run the method load_scripts I get Fatal error: Maximum function nesting level of '200' reached, aborting! in /srv/www/starter-theme.com/current/web/wp/wp-includes/cache.php on line 724

    If I comment out the method or even the add_action, all is fine.

    Any insight?

    Code Below:

    
    class Theme_Setup {
    
      public function __construct() {
         
        $this->load_scripts();
      
      }
    
      public function load_scripts() {
      
        add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
      
      }
      
      public function register_scripts() {
      
        wp_enqueue_scripts( 'foundation-js', PARENT_URL . '/dist/scripts/foundation.min.js', array( 'jquery' ), '6.2.3', true );
    
      }
    }
    
    • This topic was modified 8 years, 5 months ago by TheAggressive.
Viewing 1 replies (of 1 total)
  • Thread Starter TheAggressive

    (@theaggressive)

    Found out it was because I had a typo.

    It should be

    wp_enqueue_script

    NOT

    wp_enqueue_scripts

    so the corrected line should be:

    wp_enqueue_script( 'foundation-js', PARENT_URL . '/dist/scripts/foundation.min.js', array( 'jquery' ), '6.2.3', true );

    • This reply was modified 8 years, 5 months ago by TheAggressive.
Viewing 1 replies (of 1 total)
  • The topic ‘Maximum function nesting level of ‘200’ reached’ is closed to new replies.