Title: wp_insert_post
Last modified: July 17, 2024

---

# wp_insert_post

 *  Resolved [enkirch](https://wordpress.org/support/users/enkirch/)
 * (@enkirch)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/)
 * Hi,
 * if i do this
 *     ```wp-block-code
               $my_post = array(
                   'post_title'   => $label, // Label wird als Titel verwendet
                   'post_name'    => $titelform, // Titelform wird als Slug verwendet
                   'post_status'  => 'publish',
                   'post_type'    => 'manufacturer'
               );
   
               $result = wp_insert_post($my_post);
       ```
   
 * i get this
    1. _
       {key: ‘9225f6221f2528d68389b274d5f16ba5’, type: ‘warning’, message: ‘rmdir(
       D:\\xampp-8-1-25\\htdocs\\xxxx/wp-content/cache…ost/xxxx/marke/vespa/): No such
       file or directory’, file: ‘wp-content/plugins/wp-super-cache/wp-cache-phase2.
       php’, line: 3209, …}
    2.  a. **component**: “Plugin: wp-super-cache”
        b. **file**: “wp-content/plugins/wp-super-cache/wp-cache-phase2.php”
        c. **key**: “xxxxx”
        d. **line**: 3209
        e. **message**: “rmdir(D:\\xampp-8-1-25\\htdocs\\xxxx/wp-content/cache/supercache/
           localhost/xxxx/marke/vespa/): No such file or directory”
        f. **stack**: (9) [‘rmdir()’, ‘wp_cache_post_id_gc()’, ‘wp_cache_post_change()’,‘
           wp_cache_post_edit()’, “do_action(‘clean_post_cache’)”, ‘clean_post_cache()’,‘
           wp_insert_post()’, ‘import_manufacturer_from_acf_list_callback()’, “do_action(‘
           wp_ajax_import_manufacturer_from_acf_list_callback’)”]
        g. **type**: “warning”
 * The path “D:\xampp-8-1-25\htdocs\xxxx/wp-content/cache/” ist existing and caching
   is working. the post is also created without any problems
    -  This topic was modified 1 year, 10 months ago by [enkirch](https://wordpress.org/support/users/enkirch/).

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17904479)
 * What version of WP Super Cache are you using there? The `wp_cache_post_id_gc`
   function that calls `rmdir` is not around line 3209. The `rmdir` is at 3241 in
   version 1.12.3 which was current when you posted this. It’s also suppressed so
   that warning shouldn’t show.
 * It’s a harmless warning that won’t interfere with your site, although I’m annoyed
   it’s showing at all. It shouldn’t.
 *  Thread Starter [enkirch](https://wordpress.org/support/users/enkirch/)
 * (@enkirch)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17904538)
 * Hi,
 * we´re running the plugin on several WP Installs. The Notice is with, Version 
   1.11.0 and 1.12.4.
 * Im not sure which version i had on my local machine when copy the notice message.
 * It’s just a bit scary when you’re writing a plugin that creates 200 posts via
   a list and then you get 200 “error” messages 🙂
 * This is also me: [https://github.com/Automattic/jetpack/issues/38404](https://github.com/Automattic/jetpack/issues/38404)
   FYI
    -  This reply was modified 1 year, 10 months ago by [enkirch](https://wordpress.org/support/users/enkirch/).
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17904853)
 * Thanks for linking there. I’ll reply there and mark this ticket as resolved.
 *  Thread Starter [enkirch](https://wordpress.org/support/users/enkirch/)
 * (@enkirch)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17904931)
 * For completeness. the error was actually only shown to me in “Query Monitor –
   The developer tools panel for WordPress” plugin, not in the debug.log of WordPress
   itself.
 * If I search in the plugin for error_get_last I even find 2 places where this 
   is used.
 * Apparently you can turn this off if you define something in the wp-config.
 * Thank you very much for your effort!
 *  Thread Starter [enkirch](https://wordpress.org/support/users/enkirch/)
 * (@enkirch)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17935387)
 * Hi, question,
 * if i do this in the wp_cache_post_id_gc function would this be ok?
 * if (is_dir($dir)) {
   rmdir($dir);}
 * the error only occurs because an attempt is made to delete a folder that does
   not exist, but if you first ask whether the path exists and then delete it, you
   do not need to suppress the error with “@”.
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17936475)
 * Yeah, that will work. It’ll be overwritten the next time you update the plugin,
   however. We will need to make that change in the plugin itself for it to be permanent.
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17938463)
 * I forgot to say that you may still see odd errors. If a request comes for the
   post being edited at the wrong time, the request will create the directory after
   the is_dir() which means that it won’t be removed.
 * Or another process removes the directory after is_dir() runs, then rmdir() will
   try to remove a non-existent directory.
 * It’s unlikely but worth bearing in mind, especially if you have a busy site.
 *  Plugin Support [Stef (a11n)](https://wordpress.org/support/users/erania-pinnera/)
 * (@erania-pinnera)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17954146)
 * Hi there [@enkirch](https://wordpress.org/support/users/enkirch/),
 * Do you have updates about that, do you still need help? We usually close inactive
   threads after one week of no movement, but we want to make sure we’re all set
   before marking it as solved. Thanks!
 *  Thread Starter [enkirch](https://wordpress.org/support/users/enkirch/)
 * (@enkirch)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17954179)
 * HI I didn’t give it any more thought here. it is, after all, a false error.
 * And as Donncha O Caoimh (a11n) wrote,
 * “Yeah, that will work. It’ll be overwritten the next time you update the plugin,
   however. We will need to make that change in the plugin itself for it to be permanent.”
 * Now I’ll just wait for you to push a small update in between where this “error”
   is caught 🙂
 *  Plugin Support [Stef (a11n)](https://wordpress.org/support/users/erania-pinnera/)
 * (@erania-pinnera)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17970717)
 * Hello [@enkirch](https://wordpress.org/support/users/enkirch/),
 * > Now I’ll just wait for you to push a small update in between where this “error”
   > is caught 🙂
 * I checked with Donncha and the team about an ETA for the change to be implemented,
   and we’re going to include it in our next plugin update. We don’t have an ETA
   for it at the moment, so keep an eye on the Updates page of your WP Admin so 
   you’ll see the update available as soon as it’s up.
 * Or, if you have automatic updates enabled for WP Super Cache, you will be set
   once the update is released. Hope that helps!

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘wp_insert_post’ is closed to new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

 * 10 replies
 * 3 participants
 * Last reply from: [Stef (a11n)](https://wordpress.org/support/users/erania-pinnera/)
 * Last activity: [1 year, 9 months ago](https://wordpress.org/support/topic/wp_insert_post-9/#post-17970717)
 * Status: resolved