• My snippet

    
    <?php
    
    define('MY_CONSTANT", '...');
    
    function foo() {
      echo MY_CONSTANT; // doesn't work
    }
    

    I had to move the define statement to wp-config.php.

    but how can I make constants in snippets work?

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    I tried using this code, and it works exactly as expected:

    define( 'SECRET_MESSAGE', 'shhh!' );
    
    add_filter( 'admin_footer_text', function ( $text ) {
      return $text . '<br>' . SECRET_MESSAGE;
    } );

    Can you elaborate on what exactly is going wrong? Do you receive some sort of error message?

Viewing 1 replies (of 1 total)
  • The topic ‘unable to access constants defined in snippet’ is closed to new replies.