How to add no-follow attribute for certain external link

Exactly! would you like to add nofollow attribute to a certain external link or domain address. Here is the solution I got for my client's site.

The purpose was to add nofollow attribute to affiliate links so that Google index nofollowed to all affiliate links for certain domain URL. Below is the code snippet to add your theme's functions.php file.

//* Add no-follow attribute for certain external link
function add_nofollow( $content ) {

    $my_xurl = "https://www.example.com";
    preg_match_all( '~<a.*>~isU', $content, $uri_match );

    for ( $i = 0; $i <= sizeof( $uri_match[0] ); $i ++ ) {
        if ( isset( $uri_match[0][ $i ] ) && ! preg_match( '~nofollow~is', $uri_match[0][ $i ] )
             && ( preg_match( '~' . preg_quote( $my_xurl ) . '~', $uri_match[0][ $i ] ))
            ) {
            $uri_change = trim( $uri_match[0][ $i ], ">" );
            $uri_change .= ' rel="nofollow">';
            $content = str_replace( $uri_match[0][ $i ], $uri_change, $content );
        }
    }

    return $content;
}

add_filter( 'the_content', 'add_nofollow' ); 


Now, you have to change or replace the URL of https://www.example.com with your targeted URL so that our function work for the URL.

If you are unable or face any issue don't forget to comment below. Thanks :)

Read More: WordPress: Remove Query Strings From Static Resources

WordPress: Remove query strings from static resources

Dealing with performance optimization for website is really shit when you are not gonna able to solve it by anyway. But if you think and want it to get done successfully as soon as possible then here blow is the solution to remove query strings from static resources.



I have been working for performance optimization of websites and got the easiest way to remove query strings. Below is the code to add your theme's functions.php file

//* Remove Query Strings
function _remove_script_version( $src ){
    $parts = explode( '?ver', $src );
        return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); 


There are available alternative ways to solve it but if you use the above function to your theme would be great rather than using a WordPress plugin.

# Alternative Solution

Code is incredibly fascinating and love to write all the time but too lazy. For the folks who is like me and would like to eat ready dinner then they always have the alternative solution on Web.

A guy has built a WP Plugin to remove query strings from static resources. You can easily download it from WordPress.org plugin's directory. 

SEO In Palm Beach Is In High Demand These Days

Keep away from SEO experts that will not easily evaluate their strategies thoroughly, advises Rand Fishkin, developer of Moz, a Seattle-based internet marketing software application business and co-author of The Art of Online search engine Optimization (O’Reilly, 2012). They should describe the methods they would certainly make use of to increase your web site’s search engine ranking, along with cost quote just exactly how long it can fairly require to achieve the Search Engine Optimization job objectives you agree on.

Make sure the SEO solution proposition includes an initial technological testimony of your website to extract any type of type of troubles that might lower your online online search engine placement, including harmed web links and error web pages. Consultants and Palm Beach SEO leaders ought to provide “on web page” optimization, a procedure to make your site as online search engine friendly as feasible. It consists of boosting your internet site’s URL and internal connecting framework, along with developing web page titles, headings and tags.
Likewise, ask consultants if they offer “off page” Search Engine Optimisation approaches to enhance understanding of your content on different other websites, often through blog websites, social networks systems and news release.
Appearing in the leading regional online online search engine outcomes like this company does http://westpalmbeachseo.net is particularly essential to tiny brick-and-mortar firms attempting to generate bordering consumers, Rand claims. You’ll want a professional that has encounter in regional Seo methods.
If your internet site is enhanced wherefore’s known as “community Online search engine Optimisation,” it needs to appear when an individual nearby is looking for key words that relate to your business. To acquire that, a Search Engine Optimization company needs to include your company’s city and state to your site’s title tags and meta descriptions, and obtain your site provided on Bing, Yahoo and google’s regional listings, which are online directory websites of businesses that cater to a certain topographical place.

How To Choose The Right SEO Company

Steer clear of from Search Engine Optimization experts that won’t conveniently review their methods completely, cautions Rand Fishkin, developer of Moz, a Seattle-based internet marketing software program application business and co-author of The Art of Search Engine Optimization (O’Reilly, 2012). They need to clarify the strategies they would certainly use to boost your website’s online search engine rank, and also price quote simply exactly how long it could fairly take to acquire the Online search engine Optimization project objectives you agree on.


Make sure the Chicopee SEO firm proposition consists of an initial technical testimonial of your internet site to remove any sort of type of problems that might lessen your on-line search engine position, containing damaged hyperlinks and error web pages. Consultants likewise should certainly give “on page” optimization, a procedure to make your website as online search engine friendly as possible. It consists of improving your net website’s LINK and internal hooking up framework, along with setting up website page titles, headings and tags.
Additionally, ask consultants if they offer “off web page” SEO approaches to improve understanding of your content on different other websites, regularly through blog site websites, social networks systems and news release.
Showing up in the leading local online search engine outcomes is particularly critical to small brick-and-mortar companies attempting to bring in neighboring customers, Rand cases. You’ll desire an expert that has experience in neighborhood Search Engine Optimization methods.
If your internet site is improved wherefore’s called “neighborhood Online search engine Optimization,” it should appear when an individual nearby is searching for key words that associate with your company. To acquire a top SEO Chicopee Mass has some great options.  Your Search Engine Optimization company should include your firm’s city and state to your website’s title tags and meta descriptions, and get your website noted on Bing, Yahoo and google’s neighborhood listings, which are online directory site websites of businesses that satisfy a particular topographical area.

What is a Responsive Website?

A responsive website, simply put, is a website that looks great no matter what device you’re viewing it on.

Responsive websites are now a requirement, as important as the website itself. Devices such as a desktop or laptop computer, any sized tablet, or any type of phone - your website should look great regardless of operating oystem, browser, browser version, or the brand of device.

How to create a minimalist website for passion

35% of Canadian guys create website to share their hobbies & passion with the world. They share charming moments of them to inspire their mates. If you are one of them & want to create a website for your passion then this is the post only for you.

Why Should You Create A Landing Page For Your Website

Blogging brings a vast area. And it's tough to reach every single corner of it, I think. A blogger should know everything from scratch to print out. Today's blogging style so far from ancient. Most of the bloggers now conscious of getting their target done.

If you have a website or want to launch one, it is important to focus on strategies that will drive more traffic to your website as well as generate sales. If you have been online for a while, I'm sure you have seen great websites like Amazon and the like have landing pages.

How to Choose Genesis Framework Child Theme for WordPress Blog

Genesis is believed to be the most popular theme framework for WordPress. It’s built using clean and efficient codes to get a fast loading website. There is the nearly infinite pool of WordPress themes to choose from, and that’s why it becomes overwhelmingly easy to feel confused on what to select.



In WordPress, the blog’s overall look is determined by the theme you choose. In fact, the theme you select should match the content of your blog. The first time you install WordPress, the self-hosted site will still use a basic default theme that comes prepackaged with WordPress.