• sbaron

    (@sbaron)


    First off I am not very good at programming (rudimentary at best) I learn by taking snippets of code and piece them together watch the errors and then try to figure out how to resolve them. My latest attempt seems to be getting the best of me however as I can not seem to understand where I am running astray.

    The error I am receiving is:
    PHP Warning: Use of undefined constant plugins_url – assumed ‘plugins_url’ (this will throw an Error in a future version of PHP)

    It seems line #18 (the last IF statement) is where I am going wrong. I am hoping someone can show me the corrected syntax and provide a simplistic explanation so I can hopefully understand it.

    The code I am attempting to use:

    <?php
    
    if ( ! defined( 'WP_CONTENT_URL' ) )
        define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
    
    if ( ! defined( 'WP_CONTENT_DIR' ) )
        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
    
    if ( ! defined( 'WP_PLUGIN_URL' ) )
        define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
    
    if ( ! defined( 'WP_PLUGIN_DIR' ) )
        define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
    
    if ( ! function_exists(plugins_url) ) {
    	function plugins_url($location) {
    		return WP_PLUGIN_DIR.$location;
    	}
    }

    Thanx in advanced…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Dion

    (@diondesigns)

    The first line of your code should be this:

    if ( !function_exists('plugins_url') ) {

    The function name must be enclosed with single quotes.

    Thread Starter sbaron

    (@sbaron)

    I can’t believe I missed that… Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP Warning message’ is closed to new replies.