View Categories

SEO Plugins

Table of Contents

Some SEO WordPress plugins may affect the page titles of dynamically generated pages, such as the Model Profile pages (which displays the model profile data, embedded live video player and other similar live webcam models).

The following code snippets are provided below to work with several of the most popular WordPress SEO plugins. You can insert the code using an additional WordPress plugin such as WP Code.

SEOPress #

The following code will add a WordPress filter for the SEOPress plugin to set the page <title> of the webcam model profile page:

<?php
function seopress_webcams_page_titles($html) {

	global $sites_array;
	global $post;
    
	$post_slug = $post->post_name;
	
	if($post_slug == 'webcams'){

		// get site name and model username
		$site = get_query_var('site');
		$username = get_query_var('username');		
		
		// get formatted site name from array
		$site_name = $sites_array[$site];
				
		// write page title
		$title = $username. ' Live Webcam on '.$site_name;
		return $title;
	}
}
add_filter('seopress_titles_title', 'seopress_webcams_page_titles');
?>

YOAST #

The following code will add a WordPress filter for the YOAST plugin to set the page <title> of the webcam model profile page:

<?php
function yoast_custom_title( $title ){
	
	global $sites_array;
	global $post;
    
	$post_slug = $post->post_name;
	
	if($post_slug == 'webcams'){
		
		// get site name and model username
		$site = get_query_var('site');
		$username = get_query_var('username');
	
		// get formatted site name from array
		$site_name = $sites_array[$site];
				
		// write page title
		$title = $username. ' Live Webcam on '.$site_name;
		return $title;
    }   
    return $title;
}
add_filter('wpseo_title','yoast_custom_title');
?>

Rank Math #

Rank Math SEO plugin provides several filters and hooks for its SEO filters, with the documentation found here.

The following code will add a WordPress filter for the Rank Math SEO plugin to set the page <title> of the webcam model profile page:

<?php
function rankmath_custom_title( $title ){
	
	global $sites_array;
	global $post;
    
	$post_slug = $post->post_name;
	
	if($post_slug == 'webcams'){
		
		// get site name and model username
		$site = get_query_var('site');
		$username = get_query_var('username');
		
		// get formatted site name from array
		$site_name = $sites_array[$site];
				
		// write page title
		$title = $username. ' Live XXX Webcam on '.$site_name;
		return $title;
    }   
    return $title;
};

add_filter('rank_math/frontend/title', 'rankmath_custom_title');

?>