Removing calls to noindex() and wp_no_robots()

Why you are changing the code for these thing which are able done via dashboard.? WordPress comes with a built-in feature that allows you to instruct search engines not to index your site. All you need to do is visit Settings » Reading and check the box next to Search Engine Visibility option. When this … Read more

Check If search query contains something?

After the question’s update, I think that you need to set the canonical URL: add_action( ‘wp_head’, ‘cyb_search_results_canonical_URL’ ); function cyb_search_results_canonical_URL() { if( is_search() ) { $link = get_search_link(); echo ‘<link rel=”canonical” href=”‘ . esc_url( $link ) . ‘”>’; } } And your problem with duplicated content is fixed.

Noindex subscriber author page

The function you want is get_userdata(). Since you need to do this outside the loop, the process is a little less straight-forward. The first thing you need to do is set up a variable called $curauth which is an object that you create by accessing the database by using the $_GET[] superglobal. $curauth = ( … Read more

How to noindex automatically all post of a specific category? [closed]

Being excluded-cat and excluded-cat-1 the categories you want to exclude from indexing: add_action(‘wp_head’,’AS_exclude_category_from_indexing’); function AS_exclude_category_from_indexing(){ $html=””; if(has_category(‘excluded-cat’) || has_category(‘excluded-cat-1’)){ $html= “<meta name=\”robots\” content=\”noindex,follow\”>”.PHP_EOL; } echo $html; }

Noindex Posts From Certain Authors In WordPress

From codex: is_author() is a conditional tag which determines whether the query is for an existing author archive page. so it does not work for your scope. Best solution, instead of using the template file header.php is to write a function in functions.php hooking the proper action wp_head: add_action(‘wp_head’,’AS_exclude_author_from_indexing’); function AS_exclude_author_from_indexing(){ $toIndex = array(111,112,113); $user_id … Read more

Force meta data on specific product type

You can try the wp_head hook: add_action( ‘wp_head’, ‘check_for_enviso_group_ticket’ ); function check_for_enviso_group_ticket() { if ( is_product() && ( ‘enviso_group_ticket’ == get_the_terms( get_the_ID(), ‘product_type’ )[0]->slug ) ) { echo ‘<meta name=”robots” content=”noindex,nofollow”/>’, PHP_EOL; } } or to not break your site in case the WooCommerce is disabled and the is_product() function isn’t defined: add_action( ‘wp_head’, ‘check_for_enviso_group_ticket’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)