Hi,
This is a general WP question and would fit better on the general support pages on https://wordpress.org/support/
But just give you a starting point for e.g. the archives, adding this in your functions.php might help:
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( is_archive() ) {
echo '<meta name="robots" content="noindex,follow" />';
}
}
Hi,
I don’t think this is a general question since bbpress states to be compatible with Yoast and Tsf when it is not (at least when it comes to noindex pages) so, imho, it is a BBpress problem.
https://github.com/sybrew/the-seo-framework/issues/243
I asked the same question on wp support anyway and still didnt get any answers (it took almost one week to have one here so I guess I’ll be waiting for some days there as well – https://wordpress.org/support/topic/noidex-metatag-to-groups-of-pages/)
I added your code (thank you for writing it down) but I only see a white page afterwards.
I added it to functions.php in wpcontent/themes/forum/ is it correct?
Thank you,
the Process
That should be the correct functions.php, yes.
As the theme is not open sourced, I cannot see how the different archives and pages you mentioned are setup. If they are really bbPress pages, then the above should at least add the meta tag when looking at the source of the html page.
You could also try (make sure to copy it from here on the forum, not from an email that you get):
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_topic_archive() || bbp_is_forum_archive() ) {
wp_no_robots();
}
}
Maybe have the theme author have a look at the above code and ask him to add an option in the theme?
Hi and thank you very much,
we are close but not there yet: this last code works, but writes the meta-tag on <b>each page of the forum</b>, not only the archives.
How is it possible to make it work only for archives pages?
Thank you,
the Process
@process_of_illumination, Is your forum public? Or could you somewhere grant me access?
I would need to check what you exactly mean with ‘Category Archives’ and ‘Tag Archives’
Sure! And thanks!
I need to noindex especially urls like:
/forumgm/profile/luki
and
/forumgm/topic-tag/delega
Thank you,
the Process
I just added this on my test site:
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_single_user_profile() ) {
wp_no_robots();
}
}
And I when I go to the profile of a user (in my case /forums/users/user1/), I now correctly find:
<meta name='robots' content='noindex,follow' />
Could you have a check on your side?
Thank you very much Pascal,
your code works smoothly!
Could you tell me, please, how to change this:
bbp_is_single_user_profile
to prevent indexing /topic-tag/? I am not a developer and tried some “variations on the theme” like:
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_single_user_profile() ) {
wp_no_robots();
}
}
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_single_topic_tag() ) {
wp_no_robots();
}
}
with the scarce results I am used to.
Thanks,
the Process
Unfortunately I found this problem with the code:
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_single_user_profile() ) {
wp_no_robots();
}
}
It does not add the noindex to profile sub pages:
Correctly in no NOINDEX:
/forumgm/profile/jacobus-johannes
still in INDEX:
/forumgm/profile/jacobus-johannes/topics
/forumgm/profile/jacobus-johannes/replies
/forumgm/profile/jacobus-johannes/favorites
And that is bad for Mr G indexing too many unuseful pages 🙁
the Process
great, so we are finally moving in the correct way 🙂
I hope to find some time in the next days to also check out those and then back to your initial question with the full list.
Hi,
I think I understood a little how it works and came out with this:
add_action( 'wp_head', 'casiepa5_add_noindex' );
function casiepa5_add_noindex() {
if ( bbp_is_favorites() ) {
wp_no_robots();
}
}
add_action( 'wp_head', 'casiepa4_add_noindex' );
function casiepa4_add_noindex() {
if ( bbp_is_single_user_replies() ) {
wp_no_robots();
}
}
add_action( 'wp_head', 'casiepa3_add_noindex' );
function casiepa3_add_noindex() {
if ( bbp_is_single_user_profile() ) {
wp_no_robots();
}
}
add_action( 'wp_head', 'casiepa2_add_noindex' );
function casiepa2_add_noindex() {
if ( bbp_is_single_user_topics() ) {
wp_no_robots();
}
}
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_topic_tag() ) {
wp_no_robots();
}
}
I tested it and it seems ok.
Do you think it is the correct procedure?
Thanks,
the Process
PS: could you please remove the picture with the link to my test site? Thanks 🙂
Hi @process_of_illumination ,
I see you have found the functions that you need.
Try to avoid adding 5 functions if you can do it in 1, so at least change it to:
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_favorites() ) {
wp_no_robots();
}
if ( bbp_is_topic_tag() ) {
wp_no_robots();
}
if ( bbp_is_single_user_replies() ) {
wp_no_robots();
}
if ( bbp_is_single_user_profile() ) {
wp_no_robots();
}
if ( bbp_is_single_user_topics() ) {
wp_no_robots();
}
}
Of course the shortest way would be:
add_action( 'wp_head', 'casiepa_add_noindex' );
function casiepa_add_noindex() {
if ( bbp_is_favorites() || bbp_is_topic_tag() || bbp_is_single_user_replies() || bbp_is_single_user_profile() || bbp_is_single_user_topics() ) {
wp_no_robots();
}
}
PS image removed.
Hi and thanks Pascal!
I can’t find out how to add Date Archives, do you have an advice please?
the Process