• As part of a process to stop php code being run outside WordPress ( see this post )I want to test if ‘ABSPATH’ is defined. So if from within WordPress I link to a php file I want the code to run – otherwise die.

    This code

    if( !defined( 'ABSPATH' ) )
    	die( 'Do not access this file directly' );

    however dies regardless of whether it is run within WordPress or not. What am I doing wrong ? Thanks.

  • The topic ‘Testing for a constant defined in wp-config’ is closed to new replies.