Title: Code only works with debugging enabled?
Last modified: August 20, 2016

---

# Code only works with debugging enabled?

 *  [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/code-only-works-with-debugging-enabled/)
 * This is totally puzzling. Here is the background:
    1) Woo Listings Theme with
   Custom Post types & fields 2) Custom template to list posts eligible for update
   by signed in user 3) Custom template to edit eligible posts for signed in user
   called by form submit passing post id
 * The relevant code for template in item 2
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   The maximum number of lines of code that you can post in these forums is **ten
   lines**. Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * The problem:
    When I remark out these three lines:
 *     ```
       print('<pre>');
       print_r($_POST);
       print('</pre>');
       ```
   
 * clicking the edit button from item 2 appends the url of the source page to the
   destination page and comes back with a 404.
 * I just can’t work out why it functions with the debugging code and fails without
   it. Any help will be greatly appreciated, and thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/code-only-works-with-debugging-enabled/#post-2759577)
 * I see that the code was removed from my post because I didn’t realize that the
   rules had changed.
 * Here is pastebin link for relevant code in item 2:
    [http://pastebin.com/wVb0M2km](http://pastebin.com/wVb0M2km)
 * Here is template code called by item 2
    [http://pastebin.com/m73LXuuG](http://pastebin.com/m73LXuuG)
 * Even revising the print_r code to output to a variable, removing the echo of 
   that variable caused the click to append the url of the originating page to the
   actual destination page and throws a 404.
 *  Thread Starter [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * (@marjwyatt)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/code-only-works-with-debugging-enabled/#post-2759584)
 * It seems that the problem was caused by the redirect statement in the code. First
   off, the way that the redirect is called was not an absolute path, which is what
   I learned that function for redirecting required. I finally removed the redirect
   in the template because printing debugging content forced it to stay on the page.
 * I don’t know if we need to keep this open but I will continue to report back 
   here as things progress.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Code only works with debugging enabled?’ is closed to new replies.

## Tags

 * [form submit](https://wordpress.org/support/topic-tag/form-submit/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 1 participant
 * Last reply from: [Marj Wyatt](https://wordpress.org/support/users/marjwyatt/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/code-only-works-with-debugging-enabled/#post-2759584)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
