• Resolved lukechinworth

    (@lukechinworth)


    With Block Editor Colors plugin active, when we upload to the media library the file is being put in an old folder (2023/03, current date is 2024/06). This is because get_post(0) is returning the first block_editor_color likely due to global $post polution. We determined this was caused by the WP_Query in CustomColorsService.php set_colors. I see the wp_reset_postdata() after the loop, but for some reason it’s not reseting it. Can you change the WP_Query to get_posts to avoid this issue?

    	private function set_colors() {

    $args = array(
    'post_type' => $this->color_cpt_slug,
    'orderby' => 'menu_order',
    'order' => 'ASC',
    'numberposts' => -1
    );

    $posts = get_posts( $args );
    $colors = [];
    $disabled_colors = [];

    foreach($posts as $post) {
    if ( $post->post_status === 'publish' ) {
    $colors[ $post->ID ] = [
    'name' => $post->post_title,
    'slug' => get_post_meta( $post->ID, 'slug', true ),
    'color' => get_post_meta( $post->ID, 'color', true ),
    ];
    } else {
    $disabled_colors[ $post->ID ] = [
    'name' => $post->post_title,
    'slug' => get_post_meta( $post->ID, 'slug', true ),
    'color' => get_post_meta( $post->ID, 'color', true ),
    ];
    }
    }

    $this->custom_colors = $colors;
    $this->disabled_custom_colors = $disabled_colors;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support eugenewhite

    (@eugenewhite)

    Hello there!

    I apologize for the delayed response. 

    I wanted to let you know that I have replicated the issue on my end and have escalated it to our developers. 

    I’m hopeful that they will implement a solution in the next plugin release.?

    We inform you as soon as we have any updates on this matter.

    Plugin Support eugenewhite

    (@eugenewhite)

    Hello there! 

    I hope you’re doing well.
    I’m pleased to announce that the Block Editor Colors plugin version 1.2.6 has been released.?In this version, we have fixed the issues related to the incorrect media upload folder.?So update the plugin and let us know if there’s something we can help you with.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.