4

Thought this was a great question so I went digging. In default-filters.php on line 208 there's add_action('wp_head', 'noindex', 1); as of WordPress 4.1. The noindex() function in turn checks to see if you have set blog_public option to 0. If you have, it calls wp_no_robots() which is simply: function wp_no_robots() { echo "<meta name='robots' ...


4

Extending @prosti answer, WordPress add it using action login_head in wp-login.php itself. add_action( 'login_head', 'wp_no_robots' ); You can remove this action in theme/plugin and add your own action with custom callback function. Example:- //Keep priority 9 so we can remove WordPress action that is on 10 add_action( 'login_head', 'custom_no_robots', 9)...


3

Edit 2: By suggest of @Mark Kaplun, the general solution should be this. We will do filtering after the page is generated, so we won't care about which plugin we're using. We need a hack here to get whole page: ob_start(); add_action('shutdown', function() { $final = ''; // We'll need to get the number of ob levels we're in, so that we can ...


3

You can customize your WordPress login page with this action hook. function f1() { echo '<meta name="robots" content="noindex,nofollow" >' . "\n"; } add_action('login_head', 'f1'); The later one meta tag will prevail the original. PS. You can use filter if you plan to remove the original meta tag.


3

Use in your .htaccess: Options -Indexes … to disable directory listings. See the Apache manual for details. To restrict the access just to two URLs you might use: RedirectMatch 204 ^/wp-content/$ RedirectMatch 204 ^/wp-content/dir/$ 204 is the No Content response. Very fast. :)


2

wp_rel_nofollow() add nofollow attribute to all links so we can not use it or may be I am not sure how. You can use this function to add rel="nofollow" to all external links. This function will check all links in content against your blog/website URL (as internal domain) and add nofollow attribute if both does not match. function ...


2

I think not. Because it's not indexing the result page: See: <?php if (is_search()) { ?> if is Search doesn't index or follow the page (for example to not show duplicated content). But you can remove the code if you feel you are losing views. I was reading an article about this. Even if WordPress doesn't generate the /s=X page automatically, some ...


2

I suppose this ended up working for me. I was more hoping for some kind of better filter but it works just as well. Throw this in a functions.php file and you're good to go. /** No Index No Follow Entire Website **/ function nofollow_meta() { echo "<meta name='robots' content='noindex,nofollow' />\n"; } add_action( 'wp_head', 'nofollow_meta', 1 ); ...


2

There shout not be code like <meta name=”robots” content=”noindex,nofollow” /> with default WordPress installation unlike you place a mark for 'discourage search engines from indexing this site' with installation or using setting. If it is the case you can do following thing to remove it. Go to Settings > Reading and unmark Discourage Search Engines....


1

You want to try something like this (untested): // Nofollow in content $author_id = get_the_author_meta( 'ID' ); add_filter('the_content', 'my_nofollow'); function my_nofollow($content) { //return stripslashes(wp_rel_nofollow($content)); return preg_replace_callback('/<a[^>]+/', 'my_nofollow_callback', $content); } function ...


1

you are my hero. I solved my issue with internal links with your code. I had to modify it because i got many different rel inside my code rel="nofollow nooopener" and rel="nooopener nofollow" so i modify with this: add_filter( 'the_content', 'ex1_the_content_filter' ); function ex1_the_content_filter($content) { // finds all links in your content with ...


1

If you want to add rel="nofollow" to all the links, then you can simply use str_replace(): echo str_replace( '<a href=', '<a rel="nofollow" href=', $part_cur_auth_obj->description );


1

One part of removing your site from Google is to add <meta name='robots' content='noindex,follow' /> to every page. If you can edit the theme code then you could just add this to header.php (and any variants). You could also use a plugin. I've not tested any, but https://wordpress.org/plugins/simple-robots-meta/ claims to do the job simply.


1

/** * add nofollow to links */ function add_nofollow_content($content) { $content = preg_replace_callback( '/<a[^>]*href=["|\']([^"|\']*)["|\'][^>]*>([^<]*)<\/a>/i', function($m) { if (strpos($m[1], "YOUR_DOMAIN_HERE") === false) return '<a href="'.$m[1].'" rel="nofollow" target="_blank">'.$m[2].'...


1

Writing a robots.txt is an easy process. Follow these simple steps: Open Notepad, Microsoft Word or any text editor and save the file as 'robots,' all lowercase, making sure to choose .txt as the file type extension (in Word, choose 'Plain Text' ). Next, add the following two lines of text to your file: User-agent: * Disallow: 'User-agent' is another ...


1

Google does not index anchor tags, only URLs. (Note that by anchor tags, I assume you mean a URL like site.com/page.html#anchor) The solution is to create a separate, static URL that displays the same content as what you would get with the anchor tag - for instance site.com/page-anchor.html. Then you can just create a page with links to all these new URLs,...


1

It sounds as though a plugin or theme function is already adding 'nofollow' to the widget, so it might be a case of needing to remove a plugin not add one. It might be being added in your Theme's functions file with the following function: wp_rel_nofollow You could try searching for that function thought your plugins and themes.


1

These links are generated by alx_social_links() function. So in your theme's functions.php file, search for alx_social_links() function and this link specifically. echo '<li><a rel="nofollow" class="social-tooltip" '.$title.' '.$link.' '.$target.'><i '.$icon.' '.$color.'></i></a></li>'; and remove rel="nofollow" from it. ...


1

Based on @Robert hue's answer and the wordpress functions wp_rel_nofollow() and wp_rel_nofollow_callback I came up with this very similar solution that works for me because for some reason Robert's wasnt adding the nofollow attribute to the link. function add_rel_nofollow( $text ) { // This is a pre save filter, so text is already escaped. $text = ...


1

A simple str_replace would do the trick: $links = paginate_links( $arguments ); $links = str_replace( 'href="', 'rel="nofollow" href="', $links ); echo $links;


1

This is how I would do it : 1/ create a filter to access the post content before it's displayed on page. See http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2/ Inside your fonction called (ie : my_the_content_filter in the example from the Codex) adapt this code : https://stackoverflow.com/questions/5037592/how-to-add-rel-nofollow-to-...


Only top voted, non community-wiki answers of a minimum length are eligible