0

I'm trying to create a forum system using WP's custom post types - two post types as Topic/Reply and a Forum taxonomy.

I have created a singular template for the topic post type, in which I added a reply form. The problem is that when I submit the form I get a 404 page.

This is the form template:

<div class="topic-reply-form">
  <form method="post" name="topic-reply-form" class="topic-reply-form clear-block" action="<?php echo home_url('/'); ?>">
    <p><?php _ae("Add reply"); ?></p>
    <fieldset>
       <textarea id="reply-content" name="content" cols="50" rows="6"></textarea>
       <input type="hidden" name="topic" value="<?php the_ID(); ?>" />
       <?php wp_nonce_field('new-topic-reply'); ?>
       <input type="submit" value="Publish" id="reply-submit" name="reply-submit" />
    </fieldset>
 </form>
</div>

Any ideas why this is happening?

  • Please add your solution as answer so question can be properly resolved. – Rarst Feb 15 '11 at 19:13
2

it was the "topic" name field. It seems you can't use reserved terms in $_POST, and "topic" is a post type name, so its probably one of them...

1

FYI to anyone else who finds this, also be mindful of how you name your nonces. If there's a conflict WP won't recognize the logic in your page that verifies the nonce. It'll give you a 404.

Not fun.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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