WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
How to set a parent post of Custom post type from theme? (1 post)

  1. Claudio Adrian Marrero
    Member
    Posted 1 year ago #

    Hi all,

    I have 2 custom post type, "Tables" and "ponens", I configured with Types plugin, and I set the parent of "Ponens" with "Tables".

    I try to make a little script that insert a post from one formulary of theme of wordpress, when the user send the form, I insert a new post of "Ponens", the problem that I have is, when I make the insert with "wp_insert_post();" I need to set the parent of that post, for exmple here is my code:

    $post = array(
    'post_title' => $titulo,
    'post_content' => $resumen_ponencia,
    'post_status' => 'pending', //Set the status of the new post.
    'post_type' => 'ponencias', //You may want to insert a regular post, page, link, a menu item or some custom post type
    'post_parent'=> $list_mesas
    );

    $postId = wp_insert_post( $post );

    The insert is not the problem, the problem is that when I go to the admin of wordpress and I go to the new post that was insert, the parent is not set. The combo of list of tables appear in blank.

    Someone know how make this?.

    Thanks.

    http://wordpress.org/extend/plugins/types/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by Claudio Adrian Marrero
  • This topic is not resolved
  • WordPress version: 3.5