• When creating a new post and selecting categories Under the “Most Used” tab, only the primary category is being saved.

    It only seems to be affecting the “Most Used” category tab, they are being saved when you select categories from the “All Categories” tab.

    Only started happening with the latest WordPress 6.7 version.

    Was initially reported here as well:
    https://www.ads-software.com/support/topic/help-pls-asap/#post-18130973

    • This topic was modified 1 week, 2 days ago by mcrea1248.
Viewing 15 replies - 1 through 15 (of 18 total)
  • Same in my website, i cant change categories wehen i edit post or when i create post!!!

    Same here too, at least you saved me @mcrea1248 by saying that I can use the “All Categories” tab…

    Same here, and I thought it was my custom functions, turns out everybody seen to be having this issue as of now

    Kimber254

    (@kimber254)

    Same here.. following thread

    fabinhoalmeida

    (@fabinhoalmeida)

    Here the same technical problem with the classic editor after updating to version 6.7. Most posts assume the default category instead of the category selected by the user writer.

    shadb1

    (@shadb1)

    Same trouble here

    c1b3r3y3

    (@c1b3r3y3)

    Same here I even created a couple functions to force the categories to not been deleted but not working either. Looks like a bug from the wp new version, maybe?

    • This reply was modified 1 week ago by c1b3r3y3.
    fh

    (@felipestyle77)

    Same here

    BoUk

    (@bouk)

    Hi all,

    I’ve been experiencing similar issue on pretty much all sites which I upgraded to WP 6.7 and which are using Classic editor. The core of the problem is coming from slightly adjusted markup used for rendering category list in admin screen widget.

    As a quick fix, adding this piece of code into the functions.php of your active theme should solve the problem. Give that a try and let me know.

    add_filter('wp_terms_checklist_args', 'wpa_custom_walker_category_checklist');
    function wpa_custom_walker_category_checklist($args)
    {
    $args['walker'] = new Wpa_Custom_Walker_Category_Checklist();
    return $args;
    }

    if ( !class_exists('Walker_Category_Checklist') )
    require_once ABSPATH . 'wp-admin/includes/class-walker-category-checklist.php';

    /**
    *
    */
    class Wpa_Custom_Walker_Category_Checklist extends Walker_Category_Checklist
    {
    /**
    * [start_el description]
    * @param [type] &$output [description]
    * @param [type] $data_object [description]
    * @param integer $depth [description]
    * @param array $args [description]
    * @param integer $current_object_id [description]
    * @return [type] [description]
    */
    public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
    // Restores the more descriptive, specific name for use within this method.
    $category = $data_object;

    if ( empty( $args['taxonomy'] ) ) {
    $taxonomy = 'category';
    } else {
    $taxonomy = $args['taxonomy'];
    }

    if ( 'category' === $taxonomy ) {
    $name = 'post_category';
    } else {
    $name = 'tax_input[' . $taxonomy . ']';
    }

    $args['popular_cats'] = ! empty( $args['popular_cats'] ) ? array_map( 'intval', $args['popular_cats'] ) : array();

    $class = in_array( $category->term_id, $args['popular_cats'], true ) ? ' class="popular-category"' : '';

    $args['selected_cats'] = ! empty( $args['selected_cats'] ) ? array_map( 'intval', $args['selected_cats'] ) : array();

    if ( ! empty( $args['list_only'] ) ) {
    $aria_checked = 'false';
    $inner_class = 'category';

    if ( in_array( $category->term_id, $args['selected_cats'], true ) ) {
    $inner_class .= ' selected';
    $aria_checked = 'true';
    }

    $output .= "\n" . '<li' . $class . '>' .
    '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
    ' tabindex="0" role="checkbox" aria-checked="' . $aria_checked . '">' .
    /** This filter is documented in wp-includes/category-template.php */
    esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</div>';
    } else {
    $is_selected = in_array( $category->term_id, $args['selected_cats'], true );
    $is_disabled = ! empty( $args['disabled'] );

    $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
    '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' .
    checked( $is_selected, true, false ) .
    disabled( $is_disabled, true, false ) . ' /> ' .
    /** This filter is documented in wp-includes/category-template.php */
    esc_html( apply_filters( 'the_category', $category->name, '', '' ) ) . '</label>';
    }
    }
    }

    Hello,
    I’ve created small plugin which applies this quick fix automatically. Have tried to submit that to the official WP repository, but there seems to be a long waiting queue for approval. Let’s see.

    Either way, if anybody fancy, I am happy to provide this plugin directly.

    Has anyone tried deleting the plugin to see if that fixes the issue?

    Good Job works like a charm! YOu could upload the plugin to google drive or mega etc to make it easier for people who dont wanna mess with the functions.php

    Excellent! Thanks for confirming @geekzilla83. Feel free to download plugin from here https://wpadvisor.co.uk/plugins/category-checklist-fix.zip

    Any issues, let me know and I’ll do my best.

    Plugin Author Andrew Ozz

    (@azaozz)

    Thanks for the reports. This seems to be related to a core bug described in https://core.trac.www.ads-software.com/ticket/62440. This is most likely going to be fixed in WordPress 6.7.1.

    @bouk If I’m not mistaken your fix is to revert the changes to the outputted HTML from Walker_Category_Checklist: https://core.trac.www.ads-software.com/changeset/58894/trunk/src/wp-admin/includes/class-walker-category-checklist.php. That would work for now but will probably stop working in WP 6.7.1 as it seems this regression may be fixed in the JS, not by reverting these changes.

    In any case please keep an eye on the above Trac ticket if you use the suggested fix.

    • This reply was modified 6 days, 19 hours ago by Andrew Ozz.

    Hi @azaozz,

    Thanks for your input here. 100% agree with everything. And yes, your assumption about reverting changes made in Walker_Category_Checklist is correct. I just had to come up with some fix for the time being. This bug is especially annoying for those publishers, when they are using loads of categories. In order to correctly associate post with chosen categories, they need to switch view to ‘All Categories’ where they need to scroll through quite long list.

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