0

I have made some changes to functions.php, specifically i deregister some js libraries and then manually add them back to the footer using a plugin(header and footer plugin). That changes caused to my site a minor problem, some times when i try to visit wp-admin it shows me that message "The page cannot be displayed because an internal server error has occurred." with a blank page behind the message BUT the front site is okay. If i visit themes, plugins or anything else it is okay except mysite.com/wp-admin And i also mention it again, that occurs some times and then it is ok, not everytime.

1
  • Use is_admin to check and perform customization only in the frontend. Commented Oct 22, 2014 at 7:12

1 Answer 1

0

When you enqueue new libraries to WordPress for the sake of front-end effect only, it is highly recommended to preface the function in the conditional if (!is_admin()); , thus:

/**
 * Load newer jQuery min file.
 */
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
   wp_deregister_script('jquery');
   wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", false, null, false);
   wp_enqueue_script('jquery');
}

Additionally, wp_enqueue_script() has the necessary options to specify loading in the footer, and only once other dependencies have loaded. Read more here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.