• Resolved josflachs

    (@josflachs)


    Hi Fabio, I just found your plugin. It works like a charm, but I get a nasty php error I don’t know how to solve:

    Warning: Attempt to read property “term_id” on bool in?/home/xxx/Local Sites/gates/app/public/wp-content/plugins/list-all-posts-by-authors-nested-categories-and-titles/include/ACT-displayer.php?on line?280

    I’m working on Local by Flywheel with Elementor on Ubuntu. (no live example).

    Here’s a screenshot: https://snipboard.io/J5vriG.jpg

    How do I solve this problem?

    • This topic was modified 1 year, 5 months ago by josflachs.
Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author fmarzocca

    (@fmarzocca)

    I will have a look, but it is a Warning, so it doesn’t hurt. In the meantime, disable WP_DEBUG in your wp-config.php

    What version of php and WordPress are you running?

    • This reply was modified 1 year, 5 months ago by fmarzocca.
    Plugin Author fmarzocca

    (@fmarzocca)

    Be sure that each of your Category has a slug.

    Thread Starter josflachs

    (@josflachs)

    Woa! You’re fast!
    All categories have a slug (just checked to make sure)
    WP: 6.2.2
    PHP: 8.1.9
    wpconfig: define( ‘WP_DEBUG’, false );

    • This reply was modified 1 year, 5 months ago by josflachs.
    Plugin Author fmarzocca

    (@fmarzocca)

    Mmmh. I haven’t tried yet with php 8…

    Plugin Author fmarzocca

    (@fmarzocca)

    Can you pls post the Shortcode you are using to display that page?

    Thread Starter josflachs

    (@josflachs)

    [ACT-list show='Author']

    Plugin Author fmarzocca

    (@fmarzocca)

    This is mine, working:
    [ACT-list show="Author" exclude="News" reverse-date=1 ?postdate=1 ]

    Don’t you have unpublished articles, or orphaned/unclassified categories? The error is coming from an invalid category, but this is the first time I see it. Don’t you have the chance to switch to PHP 7.x for a test?

    Plugin Author fmarzocca

    (@fmarzocca)

    In any case, if WP_DEBUG is false, it must not display that warning.

    define('WP_DEBUG', FALSE);

    • This reply was modified 1 year, 5 months ago by fmarzocca.
    Thread Starter josflachs

    (@josflachs)

    I switch to the obsolete 7.4 version: that works. 8.02 gave me the error again. So it has something to do with the +8 PHP versions.
    The WP_DEBUG is false, but it does show the error nevertheless.

    Plugin Author fmarzocca

    (@fmarzocca)

    Ok. Thank you!

    Thread Starter josflachs

    (@josflachs)

    I’m not going live with a site on php 7.4. When do you think the plugin will be upgraded?

    • This reply was modified 1 year, 5 months ago by josflachs.
    Plugin Author fmarzocca

    (@fmarzocca)

    At the moment I have no plans to update to php 8, but can you pls make a test? Create an empty Category (i.e.: test) and then exclude that category from your shortcode:
    [ACT-list show="Author" exclude="test"]

    Thread Starter josflachs

    (@josflachs)

    It works!
    Thanks Fabio, you’re great.

    Plugin Author fmarzocca

    (@fmarzocca)

    Can I take advantage of your courtesy?

    If you edit the file ACT-displayer.php

    in: wp-content/plugins/list-all-posts-by-authors-nested-categories-and-titles/include
    go to the very end of the file and replace the function get_cats_by_slug with this one:

    function get_cats_by_slug($catslugs) {
    $catids = array();

    foreach($catslugs as $slug) {
    if (!get_category_by_slug($slug) ) break;
    $catids[] = get_category_by_slug($slug)->term_id;
    }
    return $catids;
    }

    Then remove the exclude in the shortcode and let me know if it works. In such a case I will deploy a new version.

    Thread Starter josflachs

    (@josflachs)

    Of course, I just did it and it works fine.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘php error’ is closed to new replies.