How to set all external links from a certain user to “nofollow”?

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 my_nofollow_callback($matches, $author_id) { $link = $matches[0]; $site_link = get_bloginfo(‘url’); if ($author_id === 4) { if (strpos($link, ‘rel’) === false) { $link = preg_replace(“%(href=\S(?!$site_link))%i”, ‘rel=”nofollow” $1’, … Read more

author_link filter not work correctly

The problem is that while you can change the URL, you also need to make sure WordPress knows what to do with it. This is called the Rewrite API. There’s a filter specifically for author URLs. If we print that, it looks like this: Array ( [author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2] [author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2] [author/([^/]+)/embed/?$] => index.php?author_name=$matches[1]&embed=true … Read more

Remove Comment Author Link only for subscribers

This doesn’t feel very nice since it calls get_comment() and get_userdata(), but I’m not sure there’s an obvious better way since the code that calls this doesn’t pass in the records we need: function remove_comment_author_link( $return, $author, $comment_ID ) { $comment = get_comment( $comment_ID ); if ( $comment && $comment->user_id ) { $user = get_userdata( … Read more

How to get category/tag in URL for Pagination links?

Why can you not use the core functions previous_posts_link()/next_posts_link() or posts_nav_link(), all of which already account for the taxonomy archive context? EDIT: I think I understand your question now. You want pagination links, rather than previous/next page links. WordPress also has a native function for pagination links: paginate_links() (Codex ref). Here’s how I use this … Read more

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