Support » Plugin: The SEO Framework » The SEO Framework compatible with Password Protected

  • Resolved ArtGoddess

    (@artgoddess)


    Hi all!

    I am curious about asking if it could be possible that The SEO Framework can be compatible with the Password Protected plugin, the only serious plugin that allows password-protect a full WordPress site.

    When The SEO Framework is active, a brilliant “Homepage Settings” tab is in the SEO settings of the site.

    But when Password Protected is active, these settings do not apply to the homepage that generates the plugin, which contains basically a password form. I would love to control the SEO of this homepage, as I would like it to be indexed and have all the info needed for search engines, while the rest of the site is protected.

    Thank you very much!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    Implementing your request would require some custom coding. This will do the trick:

    
    add_action( 'login_enqueue_scripts', function() {
    
    	// Allow indexing.
    	remove_action( 'password_protected_login_head', 'wp_no_robots' );
    
    	// Output TSF meta tags.
    	if ( function_exists( 'the_seo_framework' ) ) {
    		add_action( 'password_protected_login_head', [ the_seo_framework(), 'html_output' ] );
    	}
    } );

    I believe this works in a theme’s functions.php file, but I recommend adding it to a plugin for easier maintenance. Please refer to this guide on where to place filters/actions: https://tsf.fyi/docs/filters#where

    I hope this helps πŸ™‚ Cheers!

    Yes! It helps! Thank you very much! πŸ™‚

    Plugin Support Pierre LeBaux

    (@lebaux)

    Hey Diana, I hope your weekend is going well ツ If you do enjoy TSF and our support, please consider tossing us a favourable review:
    https://wordpress.org/support/plugin/autodescription/reviews/#new-post
    Takes a minute and helps us a lot! Thank you.

    @lebaux there you are… https://wordpress.org/support/topic/the-best-seo-wordpress-plugin-2/ πŸ™‚

    Using:
    1. the provided code in functions.php in my child theme
    2. The SEO Framework
    3. Password Protected plugin,

    I can see these values in the password-protected page:

    <title>...</title> from
    WP -> Setting -> General -> Site Title: πŸ™

    <meta name="description" content="..."> from
    The SEO Framework -> SEO Settings -> Homepage settings: Nice! πŸ™‚

    Is that possible to use the title from The SEO Framework in the password-protected page?

    Many thanks! πŸ™‚

    Plugin Author Sybre Waaijer

    (@cybr)

    Hi Diana,

    You can use the password_protected_wp_title filter to adjust the “Password Protected” plugin login page’s <title> contents.

    add_filter( 'password_protected_wp_title', function( $title ) {
    
    	if ( function_exists( 'the_seo_framework' ) ) {
    		$tsf   = the_seo_framework();
    		$title = $tsf->get_title( [ 'id' => $tsf->get_the_front_page_ID() ] );
    	}
    
    	return $title;
    } );

    If you can’t see the description tag, then you’ll have to load this in–but I believe the snippet in my first reply to this topic was more encapsulating:

    add_action( 'password_protected_login_head', function() {
    
    	if ( function_exists( 'the_seo_framework' ) ) {
    		$tsf         = the_seo_framework();
    		$description = $tsf->get_description( [ 'id' => $tsf->get_the_front_page_ID() ] );
    
    		echo '<meta name="description" content="' . \esc_attr( $description ) . '" />' . "\r\n";
    	}
    } );

    If you have further requests, please open a new topic πŸ™‚ Old topics tend to get lost in time (and space). Cheers!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘The SEO Framework compatible with Password Protected’ is closed to new replies.