• Hello!

    I recently started using your pluging and suddenly error logs increased (HTTP 500):

    PHP message: PHP Fatal error: Call to a member function find() on a non-object in ../wp-content/plugins/follow-nofollow-control/nofollow-control.php on line 124″ while reading response header from upstream..

    The issue affects to posts (or attachments pages that only consist of an image).

    In order to fix it, just inclose function nofplg_display_content’s body in an if like this:

    112 function nofplg_display_content($content){
    113 if ($content) {
    114 $html = str_get_html($content);
    115 $options = get_option( ‘nofplg_item’ );
    116
    117 $site_url = get_bloginfo(‘url’); $parse_site = parse_url($site_url); $site_host = $parse_site[‘host’];
    118
    119 $follow = $options[‘follow’]; $follow_epl = explode(“,”,$follow); $follows = array();
    120 foreach ($follow_epl as $fl) {$follows[] = trim($fl);}
    121
    122 $nofollow = $options [‘nofollow’]; $nofollow_epl = explode(“,”,$nofollow); $nofollows = array();
    123 foreach ($nofollow_epl as $fl) {$nofollows[] = trim($fl);}
    124
    125 foreach ($html->find(“a”) as $a){
    126 $rel = $a->rel;
    127 $href = $a->href;
    128 $parse = parse_url($href); $host = $parse[‘host’];
    129
    130 if ($options[‘default’]){ // the case default follow
    131 if(in_array($host,$nofollows)) $a->rel = ‘nofollow’;
    132 else $a->rel = ‘follow’;
    133 }
    134 else { // the case default nofollow
    135 if(in_array($host,$follows) || $host == $site_host || $host ==”) $a->rel = ‘dofollow’;
    136 else $a->rel = ‘nofollow’;
    137 }
    138
    139 } // endforeach
    140
    141 return $html->save();
    142 }
    143
    144 } // end function nofplg display content

    And that’s all 🙂

    Hope you can integrate this fix into your codebase and release a fixed version into wordpress plugin directory.

    Thanks a lot for your work!

    Dani

    https://wordpress.org/plugins/follow-nofollow-control/

  • The topic ‘PHP Fatal error’ is closed to new replies.