Site logo

Archived topic

error after updating to latest version of php

3 replies · Started by dassana on October 7, 2019

Viewing posts 1–4 of 4

hi tom

i am getting an error on all pages after updating to latest version of php 7.3.9

the error is pasted below.

Warning: Use of undefined constant is_tag - assumed 'is_tag' (this will throw an Error in a future version of PHP) in /home/vegrecip/public_html/wp-content/themes/generatepress_child/functions.php on line 136

the above error points to a certain code. after removing the code the error goes away. code is pasted below. what needs to be changed in this code so that the error is not there.

/*posts in categories*/
function wpex_order_category( $query ) {
// exit out if it's the admin or it isn't the main query
if ( is_admin() || ! $query->is_main_query() || $query->is_search || $query->is_feed ) {
return;
}
// order category archives by title in ascending order
if ( is_category() || ( is_tag)) {
$query->set( 'order' , 'dsc' );
$query->set( 'orderby', 'comment_count');
return;
}
}
add_action( 'pre_get_posts', 'wpex_order_category', 1 );

regards
dassana

Hi there,

Try replacing this line:

if ( is_category() || ( is_tag)) {

With this:

if ( is_category() || is_tag() ) {

thanks very much tom. the code worked.

You're welcome :)

This archived topic is closed to new replies.