WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Loading custom script produces error when using shortlinks (3 posts)

  1. authentictech
    Member
    Posted 2 years ago #

    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/example.com/wp-content/themes/twentyten_subtheme/functions.php:2) in /home/example.com/wp-includes/pluggable.php on line 934

    What could be causing this problem?

    Many thanks.

  2. Kevin Langley
    Member
    Posted 2 years ago #

    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.

  3. authentictech
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic