Title: PHP Include &#8211; Pages Bouncing Out of WordPress (Exec-PHP)
Last modified: August 19, 2016

---

# PHP Include – Pages Bouncing Out of WordPress (Exec-PHP)

 *  [thefluffyshrimp](https://wordpress.org/support/users/thefluffyshrimp/)
 * (@thefluffyshrimp)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/php-include-pages-bouncing-out-of-wordpress-exec-php/)
 * Hello! 🙂
 * I recently installed the Exec-PHP plugin and have been using PHP include commands
   to embed scripts into my WordPress pages.
 * So far it works almost perfectly, but I’ve been having one problem.
 * Whenever a link or button is clicked on one of these pages, the page will “bounce”
   out of WordPress.
 * You can see what I mean by visiting this page –> [http://thefluffyshrimp.com/?page_id=9](http://thefluffyshrimp.com/?page_id=9)
 * If you click the button “Add Link” at the bottom there (without filling in the
   form), the error page will open up outside of WordPress. Whereas I would prefer
   all links to open up inside the WordPress page.
 * This is particularly important for users attempting to include PHP scripts that
   involve a number of pages, such as a gallery or a links directory (ex: Page 1/
   2 / 3 / Next Page), each page of which would open up outside of WordPress when
   clicked.
 * To illustrate this problem, let’s say I use the following code in my included
   file and name it “page1.php”
 * > <?php
   >  echo “(This Is A Link To Page 2)”; ?>
 * So that page1.php contains a link to page2.php.
 * Now on my WordPress page I will include the following.
 * > <? php
   >  include “/dir/dir/page1.php”; ?>
 * If I do this, page1.php will appear in my WordPress page just beautifully…
 * But when I click the link “This Is A Link To Page 2” to go to page2.php, page2.
   php will appear as a stand alone page (it won’t appear inside the WordPress page
   as page1.php does).
 * Now I’m certain there is a way to get all pages that you click on to appear embedded
   inside the same WordPress page (without using frames/iframes), but I’m not sure
   where to start.
 * Is there an additional, preexisting plugin that assists with this reoccurring
   issue with Exec-PHP? Or is there a blog about how to do this that anyone knows
   of?
 * How can I get all clicked links in a PHP include to open within the same page(
   again, without using frames)?
 * Thank you so much to anyone willing to take the time to assist me with this. 
   🙂

Viewing 1 replies (of 1 total)

 *  [chriscupas](https://wordpress.org/support/users/chriscupas/)
 * (@chriscupas)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/php-include-pages-bouncing-out-of-wordpress-exec-php/#post-1191608)
 * try
 * <? php
    include “dir/dir/page1.php”; ?>
 * then regarding to this one
 * “Warning: Cannot modify header information – headers already sent”
 * you may want to use the built in function of php which is
 * ob_start(); – it should be placed on top
 * ob_end_flush(); – to make it cleaner

Viewing 1 replies (of 1 total)

The topic ‘PHP Include – Pages Bouncing Out of WordPress (Exec-PHP)’ is closed to
new replies.

## Tags

 * [page](https://wordpress.org/support/topic-tag/page/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [same](https://wordpress.org/support/topic-tag/same/)

 * 1 reply
 * 2 participants
 * Last reply from: [chriscupas](https://wordpress.org/support/users/chriscupas/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/php-include-pages-bouncing-out-of-wordpress-exec-php/#post-1191608)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
