Foreach issue in get_posts function

The issue is that in the beginning of each loop you reset $output to an empty string: $output=””; So when then loop has finished, $output will only contain the output of the last loop. To fix the issue you’ll just need to move this line outside of the loop, to initialise the variable, while only … Read more

My posts are getting to Auto draft when I try to Publish

Can you try the following in your wp-config.php define( ‘AUTOSAVE_INTERVAL’, 3600 ); // autosave 1x per hour define( ‘WP_POST_REVISIONS’, false ); // no revisions What this would do disable auto-save and post-revisions. Try with that, if it works could be your then it could be your internet or hosting conflicts.

        out of nowhere

Sometimes there can be space characters before the <?php at the top of the file. Or space characters after a closing ?> at the end of the file. The closing ?> is not needed in PHP files. But anything before the opening <?php, or after the not-needed ?> closing will get rendered on the page.