I am using a testimonials plugin which is working fine except for when I try to view the testimonial entry as an individual page

The plugin author suggested changing the testimonial slug and updating permalinks, which I have done but the problem persists.

I enabled debug and got the following error

Warning: current() expects parameter 1 to be array, boolean given in /home/site/domains/site.com/public_html/wp-content/themes/racks/inc/functions/entry.php on line 518

Catchable fatal error: Object of class WP_Error could not be converted to string in /home/site/domains/site.com/public_html/wp-content/themes/racks/inc/functions/entry.php on line 524

Looking up line 518 referenced in entry.php:

512.    // Single
513.        elseif ( is_single() ) {
514.            // Terms
516.            $taxonomy = $args['taxonomy'];
517.            $terms   = get_the_terms( get_the_ID(),  $taxonomy );
518.            $term    = current( $terms );
519.            $terms   = racks_get_term_parents( $term->term_id, $taxonomy );
520.            $terms[] = $term->term_id;
522.            foreach ( $terms as $term_id ) {
523.                $term    = get_term( $term_id, $taxonomy );
524.                $items[] = sprintf( $item_tpl, get_term_link( $term, $taxonomy ), $term->name );
525.            }
527.            if ( $args['display_last_item'] ) {
528.                $items[] = sprintf( $item_text_tpl, get_the_title() );
529.            }
530.        }

My php isn't great but it looks like there is some problem with the custom taxonomy created by the testimonials plugin I am using... Is this a syntax error or something else?

  • Looking ate the error and seeing WP_Error immediately raises the flag that taxonomy does not exist or the term is invalid. Add var_dump( 'The variable name' ); after each line where The variable name is the variable itself. Example would be var_dump( $taxonomy ); after the line $taxonomy = $args['taxonomy']; . This will dump the value of the variable to screen, so you can check if each variable really have the expected value and this way you can trace where the wrong values are coming from – Pieter Goosen Jan 12 '16 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.