Setting a Custom SEO Title Using Yoast Wordpress SEO API

0 votes

I've just installed this plugin on my site and it means that my custom titles that were previously set no longer work. Here's the link to the brief Wordpress SEO API doc: [http://yoast.com/wordpress/seo/api-docs/]

Previously, I did this:

$pagetitle = '' . $design['name'] . ' | Free Design from My Site';

I have a custom URL rewrite that takes a WP page /design/ and appends the design name to /design/design-name so now I've installed WP SEO, the page title is whatever the title of /design/ is and isn't specific.

According to the docs in the link above, I tried this:

function wpseo_design_detail_title($pagetitle) {
$pagetitle = $design['name'] . ' | Free Web Template from My Site';
}
add_filter( 'wpseo_title', 'wpseo_design_detail_title' );

That does remove the previous /design/ title but instead it just has the sites URL (i.e. the page title is blank).

What am I missing ?

Mar 10, 2022 in Digital Marketing by Kichu
• 19,050 points
429 views

1 answer to this question.

0 votes

Firstly disable WordPress SEO by Yoast, then add a filter to wp_title

function YourFunctionName( $title, $sep ) {

    $title = 'Your Webpage Title';

    return $title;

}
add_filter( 'wp_title', 'YourFunctionName' );

function YourFunctionName( $title ) {

    $title = 'Your Webpage Title';

    return $title;

}
add_filter( 'wpseo_title', 'YourFunctionName' );
answered Mar 11, 2022 by narikkadan
• 52,760 points

Related Questions In Digital Marketing

0 votes
0 answers

Calling Yoast SEO title in widget not work

I just install Wordpress SEO plugin by ...READ MORE

Mar 4, 2022 in Digital Marketing by Kichu
• 19,050 points
89 views
0 votes
0 answers

How to over-ride meta data in Wordpress, using Squirrly SEO

I currently have a Wordpress website using ...READ MORE

Mar 4, 2022 in Digital Marketing by Kichu
• 19,050 points
81 views
0 votes
0 answers

SEO indexing fails with lazy load images using Intersection Observer API

To improve my site performance I'm trying ...READ MORE

Mar 5, 2022 in Digital Marketing by Kichu
• 19,050 points
211 views
0 votes
0 answers

Wordpress Plug-ins: How-to add custom SEO friendly URL Handles

I was wondering if its possible to ...READ MORE

Mar 5, 2022 in Digital Marketing by Kichu
• 19,050 points
144 views
0 votes
0 answers

How can I call a WordPress shortcode within a template?

There's a plugin for the Contact us form. All ...READ MORE

Aug 3, 2022 in PHP by Kithuzzz
• 28,520 points
108 views
0 votes
1 answer

Trying to call AWS API via PHP

Try using AWS SDK for PHP, Link ...READ MORE

answered Jun 6, 2018 in AWS by Cloud gunner
• 4,660 points
1,131 views
0 votes
1 answer

How to use Blockchain receive API without exchange rate?

Your code contains the amount in USD ...READ MORE

answered Aug 21, 2018 in Blockchain by Perry
• 17,100 points
375 views
0 votes
1 answer

The uploaded file exceeds the upload_max_filesize directive in php.ini error while uploading plugin

After looking at your ERROR, it seems ...READ MORE

answered Feb 8, 2022 in Others by Soham
• 9,700 points
177 views
0 votes
1 answer

How to over-ride meta data in Wordpress, using Squirrly SEO

if (is_archive()){ add_filter('sq_title', 'filter_product_wpseo_metadesc'); function filter_product_wpseo_metadesc($wpseo_metadesc){ ...READ MORE

answered Mar 1, 2022 in Digital Marketing by narikkadan
• 52,760 points
342 views
0 votes
1 answer

How to remove home page title in Yoast SEO?

Here, you have two possibilities. You can ...READ MORE

answered Mar 4, 2022 in Digital Marketing by narikkadan
• 52,760 points
943 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP