Updating post object via ACF breaks front-end
Updating post object via ACF breaks front-end
Updating post object via ACF breaks front-end
… the problem I have now is how to actually set the post_parent on the $post object … I dont see any WordPress functions to do so… From the Codex: $post (array) (required) An array representing the elements that make up a post. There is a one-to-one relationship between these elements and the names of … Read more
As far as I remember cleanup you are talking about is performed by JavaScript so it isn’t easy to mashup with PHP. It would probably be easier to make list of changes you want performed and do it with PHP (there are cleanup-related function available in it as well).
As the commenters have noticed wp_unique_post_slug is called from wp_insert_post to ensure there are no double slugs. It is also called from two other functions, which explains why it is a separate function and not incorporated in wp_insert_post. A little used feature is the possibility to apply filters present in wp_unique_post_slug. There are two of … Read more
You can simply store the meta as an array… Also to hell with add_post_meta… I never use it. update defaults to add if the meta doesn’t exist for the post. update_post_meta($post_id, “_event_musikstil”, $event_musikstil); wordpress will store the value as a serialized array then so just retrieve it like get_post_meta($post_id, “_event_musikstil”, TRUE); Hope this helps. Another … Read more
How about redirecting specific users with a set of redirect rules? You can try using Peter’s Login Redirect plugin. Follow these steps: Install and activate the plugin. Hover on Settings in the left sidebar. Click on Login/logout redirects. Enter your custom Login URL for specific users.
The problem was that the import script had post_status as ‘published’ not ‘publish’ hope this helps someone. :facepalm
‘post_type’ => [‘page’] must be ‘post_type’ => ‘page’. Just look at the example here: http://codex.wordpress.org/Function_Reference/wp_insert_post#Example
You’re looking for wp_delete_post. <?php $some_post_id = 1; wp_delete_post($some_post_id); The above will delete the post with ID 1 — well, it will actually set it to a “trash” status. You can delete the post for real by setting the second parameter of wp_delete_post to true. <?php $some_post_id = 1; wp_delete_post($some_post_id, true); // really deletes the … Read more
Try add the second parameter like: $post_id = wp_insert_post( $new_post, true ); If it still won’t work, please var_dump the $post_id and paste here.