• Resolved tranjira

    (@tranjira)


    Hello!
    Help please. We have installed your plugin and we use breadcrumbs on the full page of the article. We enabled the Redis on our hosting service and installed the Redis Object Cache plugin for its operation. When we go to the full page of the article (template single.php) then the breadcrumbs are displayed first. But if you go to this page again, we get the error ” Error: Taxonomy is not defined!”. How can this be cured? Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Honestly not sure, as I wouldn’t think that redis caching would affect this, but apparently I’m wrong there ??

    What’s the URL for the site in question, if public?
    What plugin or theme is providing the breadcrumb functionality?

    With our plugin here, we run pretty standard code for WordPress, nothing super fancy. I know we register the taxonomies on priority 9, which would make it more important, as compared to priority 10. Both are done on the init hook.

    I am curious what is providing the error, as that would likely be the primary support staff you’d want to talk to.

    Thread Starter tranjira

    (@tranjira)

    Thanks for the answer.
    We would like to send you the website address in private messages, if possible.

    By default, we used the output of the breadcrumbs in the file function.php. But we also used different plugins. The error is the same – when the Redis Object Cache plugin is deactivated, breadcrumbs are displayed, and when activated, the error “Error: Taxonomy is not defined!”is displayed.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    [email protected] will reach me and i can look from there. Not sure if I’ll be able to infer too much, but I can give a lookover at least. Also if possible, send the code, as like a txt file, for what’s making the breadcrumbs.

    Thread Starter tranjira

    (@tranjira)

    Thanks. We sent the URL, code and screenshots with errors to the specified email address.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Received and reviewing.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I have to suspect that the issue is all coming from this portion of the code for the breadcrump function.:

    if( is_singular() ){
    	if( ! $taxonomies ){
    		$taxonomies = get_taxonomies( array('hierarchical' => true, 'public' => true) );
    		if( count( $taxonomies ) == 1 ) $taxonomies = 'category';
    	}
    	if( $term = get_the_terms( $post->post_parent ? $post->post_parent : $post->ID, $taxonomies ) ){
    		$term = array_shift( $term );
    	}
    } else
    	$term = &$wp_query->get_queried_object();
    
    if( ! $term && ! is_attachment() )
    	return print "Error: Taxonomy is not defined!"; 
    

    I do know that the error is showing on a singular post, so that first if statement gets used. However, I am suspecting that you may have more than one taxonomy that is hierarchical, which would make the $taxonomies variable an array, with more than 1 count. That’s then passed into get_the_terms(...) but that last argument is expecting a string, not a potential array. So, I think that $term is getting set to something that isn’t an array either, probably null. Thus we’re getting to the last if statement, where we have $term likely being null, and we’re not on an attachment, thus we get the error.

    it does not explain necessarily why it appears to sort of work with Redis off, but perhaps you’re momentarily getting a cached version that just doesn’t show the error.

    That’s my thoughts at least for what’s going on. Not something that CPTUI really has any control over, so I can’t make any code changes from our end, that’d help this.

    Thread Starter tranjira

    (@tranjira)

    Thank you for your answers and help. We will be think. You can close the topic.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Redis Object Cache. Error: Taxonomy is not defined’ is closed to new replies.