• Resolved Kevin Koslowski

    (@themadwizard)


    Hello there!

    First I want do remark, that I am a really big fan of your plugin. I like how it seemlesly intrgrates with the core and doesn’t clutter the backend. The free version is already great and the paid version adds nice features that I am truly considering of adding to my projects. But during my experiemnts I stumbled over a problem, that seems to be like a bug.

    When I try to add a custom post via wp_insert_post() during a custom action that is triggered from the backend list of my custom posts the plugin tries to access get_current_screen() during a filter for ‘pre_get_posts’. The error is the following:

    Notice: Trying to get property 'id' of non-object in /var/www/html/wp-content/plugins/media-library-organizer/includes/global/media.php on line 449 Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/media-library-organizer/includes/global/media.php:449

    I can workaround this bug with the following snippet before adding the post:

    remove_all_filters('pre_get_posts');

    But the correct way of handling this I think would be, if Media Library Organizer would recognize the execution during an admin-post request and would not try to access the current screen. Could you apply a fix for this into the main source?

    Greetings,
    Kevin

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with wp_insert_post during admin-post.php’ is closed to new replies.