• I’m trying to include an external file via a shortcode without using ob_clean, etc. Presently, I have a function that includes the file, which was working on its own, but when I run it through the shortcode API it simply returns true.

    Any [simple] way to hack around this?

Viewing 1 replies (of 1 total)
  • Can you paste the key parts of your code? Sometimes manipulating the output buffer (ob) is the only way to make that stuff work, e.g.

    ob_start();
    include $filename;
    return ob_get_clean();

    Remember that functions called by shortcode should return data, not print it. WP has a bad habit of blurring the two, and the over-reliance on printing has severe architectural limitations, imo. So maybe your file is printing data, and remember that print is actually a function, so it does RETURN a value… it returns TRUE if it printed successfully.

Viewing 1 replies (of 1 total)
  • The topic ‘Including a file via shortcode API’ is closed to new replies.