WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the latest Wordpress release with the default theme.

I have a function similar to this which is included and called from within a page (using exec-PHP).

<?php function myFunc($value) {
        while () // some condition {
             echo $value;
 <?php myFunc('val'); ?>

the output of the echo function is appearing at the bottom of the page instead of appearing within the correct page content section.

How can I fix this?

share|improve this question

Create a shortcode and return the content instead of echoing it out so in your functions.php file add:

function myFunc($atts,$content = null) {
    while (ture) {
       return $content;
    return '';


and in your page's content instead of using exec-PHP just call your new shortcode:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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