[NSFW] Update the plugin with corect code it give us a CPU load
-
Please update your plugin with the correct code, as every time you release a new version, we have to manually update your plugin with the correct code to avoid a 100% server load. Thank you!
Please modify in your plugin
/wp-content/plugins/yith-woocommerce-ajax-navigation/includes/widgets/class-yith-wcan-navigation-widget.php on line 651
/wp-content/plugins/yith-woocommerce-ajax-navigation/includes/widgets/class-yith-wcan-navigation-widget.php on line 652// All current filters. if ( $_chosen_attributes ) { foreach ( $_chosen_attributes as $name => $data ) { if ( $name !== $taxonomy ) { // Exclude query arg for current term archive term. while ( $in_array_function( $term->slug, $data['terms'] ) ) { $key = array_search( $current_term, $data ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict if ( $key ) { unset( $data['terms'][ $key ] ); } } // Remove pa_ and sanitize. $filter_name = urldecode( sanitize_title( str_replace( 'pa_', '', $name ) ) ); if ( ! empty( $data['terms'] ) ) { $link = add_query_arg( 'filter_' . $filter_name, implode( apply_filters( "yith_wcan_{$display_type}_filter_operator", ',', $display_type, $query_type ), $data['terms'] ), $link ); } if ( 'or' === $data['query_type'] ) { $link = add_query_arg( 'query_type_' . $filter_name, 'or', $link ); } } } }
to
// All current filters - Modify 27.12.2024
if ( $_chosen_attributes ) {
foreach ( $_chosen_attributes as $name => $data ) {
// Verific?m dac? nu suntem pe acela?i taxonomie
if ( $name !== $taxonomy ) {
// Exclude query argument pentru termenul curent al arhivei
if ( isset( $data['terms'] ) && is_array( $data['terms'] ) ) {
foreach ( $data['terms'] as $key => $term_slug ) {
if ( $in_array_function( $term_slug, $data['terms'] ) ) {
// C?ut?m termenul curent ?n lista de termeni
$key = array_search( $current_term, $data['terms'] ); // Verific?m dac? termenul exist?
if ( $key !== false ) {
// Elimin?m termenul g?sit
unset( $data['terms'][ $key ] );
}
}
}
}
// ?ndep?rt?m prefixul 'pa_' ?i aplic?m sanitizare
$filter_name = urldecode( sanitize_title( str_replace( 'pa_', '', $name ) ) );
// Verific?m dac? termenii sunt disponibili
if ( ! empty( $data['terms'] ) ) {
// Ad?ug?m termenii ca parametru ?n URL
$link = add_query_arg( 'filter_' . $filter_name, implode( apply_filters( "yith_wcan_{$display_type}_filter_operator", ',', $display_type, $query_type ), $data['terms'] ), $link );
}
// Dac? query_type este 'or', ?l ad?ug?m ?n link
if ( 'or' === $data['query_type'] ) {
$link = add_query_arg( 'query_type_' . $filter_name, 'or', $link );
}
}
}
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.