Please or Register to create posts and topics.

Forum posts not showing up in search engines like Google

PreviousPage 2 of 2

Hmm… I suspect this might be because I use Genesis themes for everything. They have built-in SEO. I have found a site where they give code for disabling Genesis SEO on a website, but I’d really just like it to apply to the Forum. Here is the code they suggest:

function genesis_disable_seo_functons() { 
    remove_filter('wp_title', 'genesis_default_title', 10, 3); 
    remove_action('get_header', 'genesis_doc_head_control'); 
    remove_action('genesis_meta','genesis_seo_meta_description'); 
    remove_action('genesis_meta','genesis_seo_meta_keywords'); 
    remove_action('genesis_meta','genesis_robots_meta'); 
    remove_action('wp_head','genesis_canonical'); 
    add_action('wp_head', 'rel_canonical'); 
 
    remove_action('admin_menu', 'genesis_add_inpost_seo_box'); 
    remove_action('save_post', 'genesis_inpost_seo_save', 1, 2); 
 
    remove_action('admin_init', 'genesis_add_taxonomy_seo_options'); 
    remove_action('edit_term', 'genesis_term_meta_save', 10, 2); 
 
    remove_action('show_user_profile', 'genesis_user_seo_fields'); 
    remove_action('edit_user_profile', 'genesis_user_seo_fields'); 
    remove_action('personal_options_update', 'genesis_user_meta_save'); 
    remove_action('edit_user_profile_update', 'genesis_user_meta_save'); 
 
    remove_theme_support('genesis-seo-settings-menu'); 
    add_filter('pre_option_' . GENESIS_SEO_SETTINGS_FIELD, '__return_empty_array'); 
}

Similarly, I’ve found this code to disable Jetpack’s Open Graph tags for the whole site.

add_filter( 'jetpack_enable_open_graph', '__return_false' );

The page ID for my forum is 4519, so I’m guessing my code for both implemented ONLY for the forum would look like this. (At least this is what I’ve put in place.):

/* REMOVE GENESIS SEO ON FORUM */

function genesis_disable_seo_functons() { 
    if ( is_page(4519)) {
    remove_filter('wp_title', 'genesis_default_title', 10, 3); 
    remove_action('get_header', 'genesis_doc_head_control'); 
    remove_action('genesis_meta','genesis_seo_meta_description'); 
    remove_action('genesis_meta','genesis_seo_meta_keywords'); 
    remove_action('genesis_meta','genesis_robots_meta'); 
    remove_action('wp_head','genesis_canonical'); 
    add_action('wp_head', 'rel_canonical'); 
 
    remove_action('admin_menu', 'genesis_add_inpost_seo_box'); 
    remove_action('save_post', 'genesis_inpost_seo_save', 1, 2); 
 
    remove_action('admin_init', 'genesis_add_taxonomy_seo_options'); 
    remove_action('edit_term', 'genesis_term_meta_save', 10, 2); 
 
    remove_action('show_user_profile', 'genesis_user_seo_fields'); 
    remove_action('edit_user_profile', 'genesis_user_seo_fields'); 
    remove_action('personal_options_update', 'genesis_user_meta_save'); 
    remove_action('edit_user_profile_update', 'genesis_user_meta_save'); 
 
    remove_theme_support('genesis-seo-settings-menu'); 
    add_filter('pre_option_' . GENESIS_SEO_SETTINGS_FIELD, '__return_empty_array'); 
    }
}  

/* REMOVE JETPACK OG TAGS ON FORUM */

  if ( is_page(4519)) {
    add_filter( 'jetpack_enable_open_graph', '__return_false' );
  }

 

So is that right? OR should I also get rid of this line that I noticed in the Genesis part?

add_action('wp_head', 'rel_canonical');

 

**** Edited to add this: I’m going to go ahead and get rid of that line that says “add_action(‘wp_head’, ‘rel_canonical’);” **** I’ll put it back if you think it should be there.

@Asgaros will you please check my site and let me know if at least the lines of code you were talking about look as they should now (canonical URL at the og meta tag fron Jetpack)? The url is https://www.eastcarolinaroots.com/community/

I changed the page name from forum yesterday when I realized that forum was showing up twice in the links.

Hello @sara

Sorry for the late reply, I am a little bit busy recently.

The code you posted above looks fine. Have you already added it to your site? The canonical and JetPack tags still appear on the forum-site:

 

Uploaded files:
  • ogmeta.PNG
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Yes, the code has been in my functions file since I posted about it a couple of days ago. I’m not sure why this isn’t working right.

You’re saying that first section of code that you highlighted, the Asgaros code, is fine, but the Jetpack tags are still the issue?

Thank you!

Again, thank you for your help and your patience, @Asgaros. I think the problematic tags may be gone. I deactivated Jetpack’s social share feature and installed another plugin for social media sharing. Jetpack apparently adds the open graph tags whenever you have any of the sharing features turned on.

Enable and Disable Jetpack Open Graph Tags

I don’t see anything that says “Open Graph Tags” in forum posts now so hopefully they will finally start getting indexed by the search engines! We’ll see!

Hello @sara

Basically I just want to show with the picture that OG-tags are created twice. Once wrong by JetPack (because they dont know the forum-title-mechanism) and once by Asgaros Forum. In this case it was not a problem because the Asgaros Forum tags appear first.

The OG-tags are gone now in the forum but there is still a wrong canonical in the beginning of your head-area (see attached image). I still think that this comes from your theme.

Uploaded files:
  • canonical.PNG
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

FINALLY! I think I may have really fixed the issue now. I’ve searched for canonical and Open Graph and the only thing I’m finding is the Asgaros-assigned canonical.  If I don’t post again you’ll know it’s really fixed this time. 🙂

Here is all of the code I’m currently using in my functions.php file to deal with this issue:

/* REMOVE JETPACK OPEN GRAPH TAGS */

  if ( is_page(4519)) {
    add_filter( 'jetpack_enable_open_graph', '__return_false' );
  }
  
/* REMOVE CANONICAL URL FROM FORUM PAGE IN YOAST SEO */
  
  if ( is_page(4519)) {
      add_filter( 'wpseo_canonical', '__return_false' );
  }
  
/* REMOVE YOAST SEO FROM FORUM PAGE */  
  
  add_action('template_redirect','remove_wpseo');

function remove_wpseo(){
    if (is_page(4519)) {
        global $wpseo_front;
            if(defined($wpseo_front)){
                remove_action('wp_head',array($wpseo_front,'head'),1);
            }
            else {
              $wp_thing = WPSEO_Frontend::get_instance();
              remove_action('wp_head',array($wp_thing,'head'),1);
            }
    }
}

 

 

Carewen has reacted to this post.
Carewen

Hello @sara

Yes, now it looks perfect! 🙂

Sometimes its really difficult to get things up and running – especially when no clear API is provided from WordPress itself for things like registering meta-data. I think the ressources and your research will also be very helpful for other users who have the same issues. Great that its working now as intended!

Sara and Carewen have reacted to this post.
SaraCarewen
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
PreviousPage 2 of 2