[Resolved] error after updating to latest version of php

Home Forums Support error after updating to latest version of php

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1028560
    dassana

    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

    #1028607
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try replacing this line:

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

    With this:

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

    #1029198
    dassana

    thanks very much tom. the code worked.

    #1029514
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.