• Resolved Shaun Williams

    (@eangulus)


    Hi,

    When I try to add this code:

    // Custom Login Branding
    // Adding the function to the login page
    add_action('login_head', 'custom_login');
    
    // Our custom function that includes the custom stylesheet
    function custom_login() {
    	echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo( 'stylesheet_directory' ) . '/login.css" />';
    }
    
    function my_login_logo_url() {
    	return get_bloginfo( 'url' );
    }
    add_filter( 'login_headerurl', 'my_login_logo_url' );
    
    function my_login_logo_url_title() {
    	return get_bloginfo( 'title' );
    }
    add_filter( 'login_headertitle', 'my_login_logo_url_title' );

    I get a 403 error. In particular if I leave out this line:

    echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo( 'stylesheet_directory' ) . '/login.css" />'; it saves fine but I put that line back in and I get the 403 error code again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Shaun Williams

    (@eangulus)

    Just an update. I am currently trying to move all my functions.php code (that is not theme specific), to code snippets, and I am getting the same error as above for anything that has a line like this:

    echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo( 'stylesheet_directory' ) . '/notice.css" />';

    Plugin Author Shea Bunge

    (@bungeshea)

    This does not answer the question of why the error is occurring, but you should be using wp_enqueue_script instead of echoing HTML. So you could alter your custom_login() function to look like this:

    function custom_login() {
    	wp_enqueue_script( 'theme-login', get_bloginfo( 'stylesheet_directory' ) . '/login.css' );
    }

    This should allow the snippet to save properly, but I am still unsure as to what is causing the error. Unfortunately, I’ve never been able to reproduce this error, and without access to a site where it exists, I have not been able to find a solution.

    Thread Starter Shaun Williams

    (@eangulus)

    You simply just have to ask if you want access.

    Let me know where I can send details to.

    Plugin Author Shea Bunge

    (@bungeshea)

    It’s really up to you – but I suppose it would help debug this problem. You can send me an email at shea [at] bungeshea [dot] com

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

The topic ‘Error Entering Code’ is closed to new replies.