[wp-trac] [WordPress Trac] #4882: Publish a new post in a specific
category
WordPress Trac
wp-trac at lists.automattic.com
Fri Aug 31 22:48:28 GMT 2007
#4882: Publish a new post in a specific category
---------------------------+------------------------------------------------
Reporter: reus | Owner: matt
Type: task | Status: new
Priority: normal | Milestone: 2.4 (next)
Component: WordPress.org | Version: 2.1.2
Severity: normal | Keywords:
---------------------------+------------------------------------------------
Hi, please help me with this problem
I need to publish a new post in a specific category and use this code, but
don't work.
{{{
<?php
// PASO DE VARIABLES
$title = $_POST['title'];
$content = $_POST['textarea1'];
$category = $_GET['cat'];
$author = $user_ID;
// create object class
class wm_mypost {
var $post_title;
var $post_content;
var $post_category;
var $post_status;
var $post_author;
}
//// my first object :-)
$wm_myobject = new wm_mypost();
// fill object
$wm_myobject->post_title = $title;
$wm_myobject->post_content = $content;
$wm_myobject->post_category = $category;
$wm_myobject->post_status = 'publish';
$wm_myobject->post_author = $author;
// feed object to wp_insert_post
wp_insert_post($wm_myobject);
?>
}}}
Thanks.
--
Ticket URL: <http://trac.wordpress.org/ticket/4882>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list