Forums

[resolved] wp insert post and custom fields (6 posts)

  1. beaver82
    Member
    Posted 1 year ago #

    Is it possible to specify custom fields with the function wp insert post?
    in the codex it doesn't specify it

    http://codex.wordpress.org/Function_Reference/wp_insert_post#Parameters

    please help

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    Retrieve the ID of your newly inserted post and use add_post_meta to give it a custom field

  3. RIKing
    Member
    Posted 1 year ago #

    Would you provide further information

  4. Henrychester
    Member
    Posted 1 year ago #

    Hi

    Please someone help

    I am a newbie at WordPress codex

    I need to know how can I make visible custom field in my post area section. It should be a part of my theme I have uploaded but unfortunately I don't receive support from them.

    Any help will be appreciated

    Henry

  5. Creative Slice
    Member
    Posted 10 months ago #

    Does anyone have an example of using wp_insert_post along with add_post_meta? The concept seems pretty clear but I haven't been able to get it working without an example.

    Thanks in advance! (and if I get it working I'll post here)

  6. Creative Slice
    Member
    Posted 10 months ago #

    Found the solution here: http://wordpress.stackexchange.com/questions/8569/wp-insert-post-php-function-and-custom-fields

    Basically you just need to add something like this right after wp_insert_post();

    add_post_meta($post_id, 'META-KEY-1', 'META_VALUE-1', true);

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.