Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Using a child theme of WP 2013 theme...

In Settings > Reading, 'Front page displays' I have selected 'static page' and assigned it a page titled Home. For that page, I've assigned a custom template.

That template calls a custom shortcode that displays a form for creating a custom post. And a loop to show the 10 most recent post of that cpt.

Everything works fine - except that on submit, it refreshes to the archive page for the category assigned when creating the custom post.

So it searches for that category.

If I call the same shortcode on a different page, such as Contact, that isn't a front page, then on submit it will refresh to that page.

Why does it search for the category when submitted from the front page? And how can I stop it?

share|improve this question
1  
paste your shortcode function here, so we can investigate why? –  Anjum Sep 5 '13 at 18:44
    
shortcode function added. If I use wp_terms_checklist, it refreshes to home page. But wp_dropdown_categories() or get_categories refreshes to archive page. –  shanebp Sep 5 '13 at 19:31
add comment

1 Answer

up vote 1 down vote accepted

add the_permalink(); in form action value, to submit the form data.

<form id="fep-new-dog" name="new_dog" method="post" action="<?php the_permalink(); ?>">
share|improve this answer
    
Thanks a lot. Pretty obvious once I see your answer, lol. Also got it working with a htaccess 301 –  shanebp Sep 5 '13 at 20:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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