Support » Fixing WordPress » Loading custom script produces error when using shortlinks

  • Resolved authentictech


    I added some JavaScript using the method described in Load a script from your theme which depends upon a WordPress Script. The script doesn’t work, but that’s another issue…. My problem is that when I include a script this way pages will only load when a custom permalink is used, but if I use a shortlink all pages will output an error like this:

    Warning: Cannot modify header information - headers already sent by (output started at /home/ in /home/ on line 934

    What could be causing this problem?

    Many thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • It sounds to me like there is an extra space somewhere in your code for it to be giving you this error. Make sure there is no extra space at the bottom of your functions.php file and any file included in there. Also, please remove all closing PHP tags from those same files as well. Hopefully that will solve the issue, otherwise you will have to dig deeper because essentially what it is doing is something is trying to output to the browser before it should be.

    Ah, yes, an extra couple of line breaks at the end of my functions.php file was the culprit.

    Do you know why it only causes problems when using shortlinks? I’m kind of curious about the mechanism behind that.

    Thanks a lot for your help, Kevin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Loading custom script produces error when using shortlinks’ is closed to new replies.