Yoast SEO update broke Load More functionality - help?

Scorpion Ghost

Elite Member
Executive VIP
Jr. VIP
Joined
Mar 22, 2013
Messages
8,730
Reaction score
10,288
Hey guys,

I did a Yoast SEO update the other day, and it broke a functionality on my Wordpress site where client feedbacks are displayed. If I deactivate Yoast, the problem goes away. The Load More functionality was implemented by a friend, but he's busy now and can't help me. The Load More is done with Ajax from what I understand.

Here are the errors I get when I click the Load More button:

Code:
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 42


Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 43


Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 49


Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home1/rolexz/public_html/MYSITE.com/wp-content/themes/PricerrTheme/ajax-more.php on line 52


And here is my Load More code from ajax-more.php

Code:
<?php
if(isset($_POST["id"]) && !empty($_POST["id"])){
require( $_SERVER['DOCUMENT_ROOT'].'/wp-load.php' );


function time_elapsed_string($datetime, $full = false) {
    $now = new DateTime;
    $ago = new DateTime($datetime);
    $diff = $now->diff($ago);

    $diff->w = floor($diff->d / 7);
    $diff->d -= $diff->w * 7;

    $string = array(
        'y' => 'year',
        'm' => 'month',
        'w' => 'week',
        'd' => 'day',
        'h' => 'hour',
        'i' => 'minute',
        's' => 'second',
    );
    foreach ($string as $k => &$v) {
        if ($diff->$k) {
            $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
        } else {
            unset($string[$k]);
        }
    }

    if (!$full) $string = array_slice($string, 0, 1);
    return $string ? implode(', ', $string) . ' ago' : 'just now';
}
//include database configuration file
include('config.php');
if(is_numeric($_GET["id"]))
{
$pid = $_GET["id"];
}

//count all rows except already displayed
$queryAll = mysqli_query($con,"SELECT COUNT(*) as num_rows FROM wp_job_ratings WHERE orderid < ".$_POST['id']." AND pid=".$pid." AND NOT reason='' ORDER BY id DESC");
$row = mysqli_fetch_assoc($queryAll);
$allRows = $row['num_rows'];

$showLimit = 5;

//get rows query
$query = mysqli_query($con, "SELECT * FROM wp_job_ratings WHERE orderid < ".$_POST['id']." AND pid=".$pid." AND NOT reason='' ORDER BY id DESC LIMIT ".$showLimit);

//number of rows
$rowCount = mysqli_num_rows($query);

if($rowCount > 0){
    while($row = mysqli_fetch_assoc($query)){
        $tutorial_id = $row["orderid"]; echo '<br>';
$query1 = mysqli_query($con, "SELECT * FROM wp_job_orders where id=".$row['orderid']." ");
while($row1 = mysqli_fetch_assoc($query1))
{
$query2 = mysqli_query($con, "SELECT * FROM wp_users where ID=".$row1['uid']." ");
while($row2 = mysqli_fetch_assoc($query2))
{ $key = 'avatar';
$query3 = "SELECT * FROM wp_usermeta where user_id=".$row1['uid']." AND meta_key = '".$key."'";
$results = mysqli_query($con, $query3);
$numResults = mysqli_num_rows($results);
if ($numResults > 0) { $query4 = mysqli_query($con,"SELECT * FROM wp_usermeta where user_id=".$row1['uid']." AND meta_key = '".$key."'");
while($row3 = mysqli_fetch_assoc($query4))
{ ?> <div class="padd10_only">
 <div class="image_holder4">
<img src="<?php echo $row3['meta_value']; ?>" width="25" height="25" /></div>
 <?php }
 
}
else
{ ?>
<div class="padd10_only">
 <div class="image_holder4">
<img src="http://MYSITE.com/wp-content/themes/PricerrTheme/images/noav.jpg" width="25" height="25" /></div>
<?php }
?>
     


                 
 <div class="title_holder4" >
                            <h2><a href="http://MYSITE.com/user-profile/<?php echo $row2['user_login']; ?>"><?php echo $row2['user_login']; ?></a>


<?php }
} ?>
<span class="rating-beeing-done">wrote <?php echo time_elapsed_string('@'.$row['datemade'].''); ?></span></h2>
                           
                     
                           
                            <div class="c111"><p><?php echo stripslashes ($row ['reason']); ?></p>
                            </div>
                           
                           
                            </div>
                           
                       
                           
                            </div>
                           

    <?php    ?>
       
<?php } ?>
<?php if($allRows > $showLimit){ ?>
    <div class="show_more_main" id="show_more_main<?php echo $tutorial_id; ?>">
        <span id="<?php echo $tutorial_id; ?>" class="show_more" title="Load more posts">Show more</span>
        <span class="loding" style="display: none;"><span class="loding_txt">Loading…</span></span>
    </div>
<?php } ?>
<?php
    }
}
?>

Can anyone help?
 
Yoast broke my site so many times I gave up.

Just switch to the All-in-One SEO plugin. It does the same thing without the hassle.
 
Yoast broke my site so many times I gave up.

Just switch to the All-in-One SEO plugin. It does the same thing without the hassle.

Thanks for the advice. But I use Yoast on all of my sites, and I'm comfortable with it, and I'm not really looking to change.

When I started out online years ago I used All-in-One SEO, and I remember it was lacking something I needed, and then somebody on this very forum suggested Yoast, and I checked it, and it had what I needed and more. So ever since I've stuck with Yoast, and it's been a pretty pain-free experience.

Until it broke this thing now.
 
What I ended up doing is restoring Yoast from a backup I had from a month ago, and that fixed the problem.

However, after a day for some reason it auto updated again, and broke the functionality again.

So I looked into it, and eventually restored the plugin again from my backup, and installed a separate plugin for the sole purpose of disabling automatic updates for the Yoast plugin.

It's working well so far...

I know this is not the solution. But until I make the money to hire someone who will be able to update what Yoast breaks, this "patch" I did will have to do.
 
Back
Top