A RARE theme conflict

Hi, we use a plugin called Coupon Creator Pro on this website:
https://yourneighbormagazine.com/

The plugin is experiencing a conflict with the theme. I almost never get conflict with your theme, so I didnt think to check it at first.

I any case, see the screenshot… we get a “critical error” notice on the “All Coupons” page. We SHOULD see a list of existing coupons. If i switch temporarily to the default 25 WP theme, the list of coupons shows… So the issue is with PRO. I did see this in the error log, not sure if it is helpful:

[06-Apr-2025 14:37:31 UTC] PHP Deprecated: Creation of dynamic property Cctor__Coupon__Main::$registered is deprecated in /home/XXXXXXXXXXXXX/public_html/wp-content/plugins/coupon-creator/src/Cctor/Main.php on line 281

I ALSO received this error from WHM:
When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.7.2
Active theme: Pro – Child Theme (version 1.0.0)
Current plugin: (version )
PHP version 8.2.28

Error Details

An error of type E_ERROR was caused in line 75 of the file /home/ynmcdgadmin/public_html/wp-content/themes/pro-child/functions.php. Error message: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, WP_Error given in /home/xxxxxxxxxx/public_html/wp-content/themes/pro-child/functions.php:75
Stack trace:
#0 /home/xxxxxxxxxx/public_html/wp-includes/class-wp-hook.php(326): your_prefix_posts_taxonomy_filter(‘cctor_coupon’)
#1 /home/xxxxxxxxxx/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#2 /home/xxxxxxxxxx/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /home/xxxxxxxxxx/public_html/wp-admin/includes/class-wp-posts-list-table.php(594): do_action(‘restrict_manage…’, ‘cctor_coupon’, ‘top’)
#4 /home/xxxxxxxxxx/public_html/wp-admin/includes/class-wp-list-table.php(1687): WP_Posts_List_Table->extra_tablenav(‘top’)
#5 /home/xxxxxxxxxx/public_html/wp-admin/includes/class-wp-list-table.php(1620): WP_List_Table->display_tablenav(‘top’)
#6 /home/xxxxxxxxxx/public_html/wp-admin/edit.php(503): WP_List_Table->display()
#7 {main}
thrown

Hello Riceman,

Thanks for writing in! Based on the Critical Error information that you gave, the issue comes from your child theme’s function.php file. You have added this custom PHP code in the child theme:

/*
Add Filter for Coupons
*/
function your_prefix_posts_taxonomy_filter() {
    global $typenow; // this variable stores the current custom post type
    
    if( $typenow == 'cctor_coupon' ) { // choose one or more post types to apply taxonomy filter for them if( in_array( $typenow array('post','games') ) ADD the taxonomy slugs here in he array.
        $taxonomy_names = array('coupon', 'cctor_coupon_category');
        
        foreach ($taxonomy_names as $single_taxonomy) {
            $current_taxonomy = isset( $_GET[$single_taxonomy] ) ? $_GET[$single_taxonomy] : '';
            $taxonomy_object = get_taxonomy( $single_taxonomy );
            $taxonomy_name = strtolower( $taxonomy_object->labels->name );
            $taxonomy_terms = get_terms( $single_taxonomy );
            
            if(count($taxonomy_terms) > 0) {
                echo "<select name='$single_taxonomy' id='$single_taxonomy' class='postform'>";
                echo "<option value=''>All $taxonomy_name</option>";
                
                foreach ($taxonomy_terms as $single_term) {
                    echo '<option value='. $single_term->slug, $current_taxonomy == $single_term->slug ? ' selected="selected"' : '','>' . $single_term->name .' (' . $single_term->count .')</option>'; 
                }
                
                echo "</select>";
            }
        }
    }
}

add_action( 'restrict_manage_posts', 'your_prefix_posts_taxonomy_filter' );

You will need to correct line 75 of your child theme’s functions.php file. If you are not the one who authored this code, you may need to contact that developer to fix the issue.

Be advised that custom PHP coding is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Best Regards.

Thanks for pointing me in the right direction. Ill take it from here.

Glad @ruenel could help! Let us know if you have more questions.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.