How to add noindex nofollow tag to bbpress user profile page?
-
Hi
The user profile pages of my bbPress forums are getting indexed in google.
Example pages
https://domainname.com/users/displayname/
https://domainname.com/users/displayname/topics
https://domainname.com/users/displayname/engagement
https://domainname.com/users/displayname/repliesSo I want to add
<META NAME=”ROBOTS” CONTENT=”NOINDEX, NOFOLLOW” />
to all the above pagesI think I need to insert the META into
wordpress > wp-content > plugins > bbpress > templates > default > bbpress > user-profile.php
But I don’t want to edit the plugin file and lose the change during plugin update.
Is there a PHP code I can use to make the insertion to the
user-profile.php
?Thanks in advance for the help
-
template are designed to be alterable and added to your theme
so
find
wp-content/plugins/bbpress/templates/default/bbpress/user-profile.phptransfer this to your pc and edit whatever you want
and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/user-profile.phpbbPress will now use this template instead of the original
of course this presume you have a child theme
Thanks for the quick reply and detailed steps @robin-w. Really helpful.
Wondering if the Meta can be added through PHP instead of using a child theme?
I use the Snippet plugin to add and keep track of code, so I don’t lose track of these customizations (and potential conflicts) in the future. So a PHP hook will be really useful.
try this
add_action( 'bbp_template_before_user_profile', 'rew_add' ); function rew_add () { echo '<META NAME=”ROBOTS” CONTENT=”NOINDEX, NOFOLLOW” />' ; }
It works. Thanks a lot @robin-w
Any chance we can add this to the beginning of the header of the user profile page?
Right now it is rendered inside the body tag.
beyond free help I’m afraid !
- You must be logged in to reply to this topic.