How many ‘wp_insert_post’ calls can be performed in one shot, in a very long ‘for’ loop?

I’m working on a plugin which has bulk post inserts using a spreadsheet. This spreadsheet can have multiple thousand rows, each row corresponding to a post. I’m parsing this spreadsheet, looping over the parsed data and using wp_insert_post to insert the posts. I noticed that when I used a spreadsheet with around 2000 entries, only … Read more

Programmatically insert hierarchical terms & set terms for post causes glitch? [duplicate]

This question already has answers here: Inserting terms in an Hierarchical Taxonomy (7 answers) Closed 8 years ago. I am inserting an array of terms into my custom taxonomy programmatically. Some terms have parents/children. After each term has been entered, I then insert an array of posts into my custom post type. After inserting each … Read more

Programmatically adding posts

I’m about to create parser which would be inserting new custom posts. So, it’s pretty simple global $user_ID; $new_post = array( ‘post_title’ => ‘My New Post’, ‘post_content’ => ‘Lorem ipsum dolor sit amet…’, ‘post_status’ => ‘publish’, ‘post_date’ => date(‘Y-m-d H:i:s’), ‘post_author’ => $user_ID, ‘post_type’ => ‘post’, ‘post_category’ => array(0) ); $post_id = wp_insert_post($new_post); But i … Read more

wp_insert_post via shell category not being inserted

I’m using this code: $post = array( ‘post_content’ => $desc, ‘post_title’ => $name_new, ‘post_status’ => ‘publish’, ‘post_type’ => ‘portfolio_page’, ‘tax_input’ => array(‘portfolio_category’ => array($cat, 18, 19)) ); if (!$post_id = wp_insert_post($post)) { die(‘Error’); } which is working perfectly when executed via web browser. Unfortunately I need to execute it via shell, and what is happening … Read more

Can I edit the wp_post > post_content right before its inserted/updated?

I would need to apply some sort of encryption on whatever gets inserted in the wp_post > post_content, so I was wondering if there is a way, either modifying the core (rather not), or using some filter or hook and function, where I could perform the encryption right before the content gets saved. And then … Read more

Is there a faster way than wp_insert_post to add content to a blog

I’ve written a plugin which retrieves an xml file, parses and creates a series of short posts from the content. Although each post is very short (sometimes just a single sentence, never more than a few sentences), there are around 1000 posts to create from the file. Using wp_insert_post takes enough time for this job … Read more