Note that there are some explanatory texts on larger screens.

plurals
  1. POwp_redirect function working locally, but not on server
    primarykey
    data
    text
    <p>I'm using code directly from this tutorial: <a href="http://voodoopress.com/how-to-post-from-your-front-end-with-no-plugin/" rel="nofollow">http://voodoopress.com/how-to-post-from-your-front-end-with-no-plugin/</a>. When set up locally the redirect works fine. When the exact same site is hosted on a rackspace cloud site, it doesn't. What's going on?</p> <p>Notable piece: </p> <pre><code>if( 'POST' == $_SERVER['REQUEST_METHOD'] &amp;&amp; !empty( $_POST['action'] ) &amp;&amp; $_POST['action'] == "new_post") { // Do some minor form validation to make sure there is content if (isset ($_POST['title'])) { $title = $_POST['title']; } else { echo 'Please enter the wine name'; } if (isset ($_POST['description'])) { $description = $_POST['description']; } else { echo 'Please enter some notes'; } $tags = $_POST['post_tags']; // ADD THE FORM INPUT TO $new_post ARRAY $new_post = array( 'post_title' =&gt; $title, 'post_content' =&gt; $description, 'post_category' =&gt; array($_POST['cat']), // Usable for custom taxonomies too 'tags_input' =&gt; array($tags), 'post_status' =&gt; 'publish', // Choose: publish, preview, future, draft, etc. 'post_type' =&gt; 'post' //'post',page' or use a custom post type if you want to ); //SAVE THE POST $pid = wp_insert_post($new_post); //SET OUR TAGS UP PROPERLY wp_set_post_tags($pid, $_POST['post_tags']); //REDIRECT TO THE NEW POST ON SAVE $link = get_permalink( $pid ); wp_redirect( $link ); } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM //POST THE POST YO do_action('wp_insert_post', 'wp_insert_post');` </code></pre> <p>It's pretty straightforward. The code is posting a post using <code>wp_insert_post</code> and redirecting to that post's link afterward. All well and good, and it works on my XAMPP setup. But here's the issue: I can't get any permutation of this to work on a live server. I've started with fresh WP installs several times, only placing this code in a home.php, and to no avail. Any idea as to what the heck could be the problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload