Wordpress remove Robots Meta Tag noindex
i Developed an E commerce site for a client and i was stacked with this issue for more than a week, all pages were indexed except for the Home Page.
After a long debugging of Yoast Seo Plugin, i got a solution for you guys.
SOLUTION The Homepage has a search page on it (for searching for products). By default, Yoast disables 'index' meta tag for Search Page and 404 Page. funny enough if your homepage has a search page or search functionality on it, your site may not be indexed by google or any other search engine.
To fix this default by Yoast SEO Plugin, follow the following steps:
STEP 1: Log into your cpanel and navigate to /public_html/yourwebsite.com/wp-content/themes/nameOfTheTheme/functions.php add this line of code to your theme's function.php file (at the top of the page)
/**
* EDITED BY OBOT ERNEST
* REMOVES NOINDEX META TAG FROM HOME PAGE & SEARCH PAGE IMPLEMENTED BY YOAST
*/
add_filter('wpseo_robots', 'yoast_no_home_noindex', 999);
function yoast_no_home_noindex($string= "") {
if (is_home() || is_front_page() || is_search()) {
$string= "index,follow";
}
return $string;
}
After pasting the code, save and close file.
STEP 2 Note this second step is for those that are using any of the following SEO plugins (Yoast Premium, Yoast Free or wordpress-seo-premium plugin)
Navigate to: /public_html/youwebsite.com/wp-content/plugins/wordpress-seo-premium/frontend/class-frontend.php
replace the code at line 713 with this one below here:
Save file and close
Congratulations! you just made it.It working perfectly guys!
Wordpress change x-robots-tag
I received a response from the hosting agency. The site at the moment is still on a subdomain of the hosting agency. They replied: "It comes from the nginx setup for default domains. Once you will use the domain name this would get resolved." So, once I switch to my own domain it should be resolved and I think the conclusion is that the nginx server configuration is the cause (set up this way on purpose).
Related Topics
Easiest Way to Implode() a Two-Dimensional Array
Wrapping a Div Around Every Third Item in a Foreach Loop PHP
Sharing PHP Session ($_Session) Across Multiple Domain
Html5 Input Type File's Multiple Attribute Not Working in Ie
How to Avoid Using PHP Global Objects
Problems with Secure Bind to Active Directory Using PHP
PHP - Override Existing Function
How to Select a Result from the Select2 Search Results
Selecting Rows Where a Field Is Null Using PHP Pdo Prepared Statements and MySQL
How to Get a List of MySQL Databases in PHP Using Pdo
Mysql: Get Total in Last Row of MySQL Result
Replace Multiple New Lines with a Single Newline
Using Ajax/Jquery to Refresh an Image
PHP - Make Multi-Dimensional Associative Array from a Delimited String
Call to Undefined Function Oci_Connect, PHP_Oci8_12C.Dll, Windows 8.1, PHP5.6.6