admin管理员组

文章数量:1026989

when I try to search something it shows me that I have an error in line 9

The code on line 9 on my page "search.php" of my theme

<div class="p-title"><h2 style="background-color: #1AB3EE;">Searching for <?php $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<strong class="terms_search">'); echo $key; _e('</strong>'); _e(' - About '); echo $count . ' '; _e('results'); wp_reset_query(); ?></h2></div>

The error message

when I try to search something it shows me that I have an error in line 9

The code on line 9 on my page "search.php" of my theme

<div class="p-title"><h2 style="background-color: #1AB3EE;">Searching for <?php $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<strong class="terms_search">'); echo $key; _e('</strong>'); _e(' - About '); echo $count . ' '; _e('results'); wp_reset_query(); ?></h2></div>

The error message

Share Improve this question asked Mar 23, 2019 at 13:17 Ol MimudOl Mimud 31 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 3

Using &new in object creation is deprecated in PHP 7+ because objects are passed by be reference by default. Remove the &

when I try to search something it shows me that I have an error in line 9

The code on line 9 on my page "search.php" of my theme

<div class="p-title"><h2 style="background-color: #1AB3EE;">Searching for <?php $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<strong class="terms_search">'); echo $key; _e('</strong>'); _e(' - About '); echo $count . ' '; _e('results'); wp_reset_query(); ?></h2></div>

The error message

when I try to search something it shows me that I have an error in line 9

The code on line 9 on my page "search.php" of my theme

<div class="p-title"><h2 style="background-color: #1AB3EE;">Searching for <?php $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<strong class="terms_search">'); echo $key; _e('</strong>'); _e(' - About '); echo $count . ' '; _e('results'); wp_reset_query(); ?></h2></div>

The error message

Share Improve this question asked Mar 23, 2019 at 13:17 Ol MimudOl Mimud 31 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 3

Using &new in object creation is deprecated in PHP 7+ because objects are passed by be reference by default. Remove the &

本文标签: problem with my my theme quotsearchphpquot