xmlrpc_getpostcategory example

$cap = ( $publish ) ? 'publish_posts' : 'edit_posts';
        if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || ! current_user_can( $cap ) ) {
            return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
        }

        $post_status = ( $publish ) ? 'publish' : 'draft';

        $post_author = $user->ID;

        $post_title    = xmlrpc_getposttitle( $content );
        $post_category = xmlrpc_getpostcategory( $content );
        $post_content  = xmlrpc_removepostdata( $content );

        $post_date     = current_time( 'mysql' );
        $post_date_gmt = current_time( 'mysql', 1 );

        $post_data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status' );

        $post_id = wp_insert_post( $post_data );
        if ( is_wp_error( $post_id ) ) {
            return new IXR_Error( 500, $post_id->get_error_message() );
        }

        
Home | Imprint | This part of the site doesn't use cookies.