Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have two front-end post submission forms. One is for normal post submission and another one is for custom post type "work" submission. The normal post submission form works fine but the custom post type form is not working ok. Here is the problem:

When the admin submit post from the custom post type form, the form gives me "Not found error" But when a user with capability of "contributor" submits the post, the post submits as a "post" not as custom post type.

What am I doing wrong here? Can anyone help?

Here is code I added to the functions.php file for normal post form:

http://pastebin.com/7A7p1Nhp

And here is the code I added to the functions.php file for the custom post type form:

http://pastebin.com/DQAiy8dF

Note: The forms are almost identical, could this be a problem?

UPDATE: I changed the custom post type form function like this: http://pastebin.com/RPJcdpEL Now both admin and contributors can submit posts but admin's submissions are added as custom post type and contributors submissions are added as normal post not as custom post type :(

share|improve this question
Can I see the code you use to register your custom post type? – Jared Jan 21 '12 at 16:08
Here: pastebin.com/JwKP21vm – Towfiq Jan 21 '12 at 20:04

closed as too localized by toscho Dec 24 '12 at 21:59

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

One problem I see is that it doesn't look like you're storing the meta values correctly.

You have "tax_input" in the array argument for wp_insert_post(). I don't know if that will store the tax_input value. I would think that the way to insert that is:

$new_post_id = wp_insert_post($post);
update_post_meta($new_post_id, 'tax_input', myvaluehere);

The code above should store the tax_input value correctly for the CPT.

share|improve this answer
thanks. but the taxonomy is adding up correctly. I updated my question.. take a look – Towfiq Jan 20 '12 at 22:23

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