I’m setting up P2 theme so that the post field displays in category pages.
I can get the category id from the page and all I want to do is simply add it to the post form.
In the post-form.php file, I’ve placed
<input type="hidden" name="post_category" id="post_category" value="<?php echo get_category(get_query_var('cat'))->cat_ID; ?>" />
right under this line:
<input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
I can view source and verify that the post_category is indeed being set in the hidden post field, but the post is not being sent to the correct category. It just goes to the default category. Is this a nonce issue?
Please advise! Thanks!
- The topic ‘[Theme P2] Categories in hidden post field’ is closed to new replies.