Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
29

The WPSEO plugin by Yoast has a filter for the title: 'wpseo_title'. You'll need to add something like this: add_filter('wpseo_title', 'filter_product_wpseo_title'); function filter_product_wpseo_title($title) { if( is_singular( 'product') ) { $title = //your code } return $title; } More info at the WordPress SEO API Docs page.


29

Add the following code in the archive template loop to display Yoast SEO meta description for each post. echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true);


25

Here's the general principle of what you need to do: Hook into the wpseo_breadcrumb_links or wp_seo_get_bc_ancestors API filters. Add your Blog into the WordPress SEO Breadcrumb $links array, using array_splice. Place this in your theme's functions.php: /** * Conditionally Override Yoast SEO Breadcrumb Trail * http://plugins.svn.wordpress.org/wordpress-...


19

It didn't say in the API docs on the Yoast SEO plugin site what the ID was and I don't have a copy of Yoast at installed at disposal, but according to yoas-plugin-dir/admin/class-metabox.php line 144, the meta_box registered is; add_meta_box( 'wpseo_meta', ...etc ); ... Which is hooked onto add_meta_boxes hook on line 32 of the same file, add_action( '...


16

On remove_meta_box is a note: Because you can't remove a meta box until it's been added, it's important to make sure your call to remove_meta_box() happens in the right sequence. WordPress SEO adds meta boxes on add_meta_boxes action with default priority - 10, which run after admin_init, so that won't remove them. Instead you need to hook into ...


15

Get Archive SEO titles If you defined a Custom Post Type archive title you can get that by: $titles = get_option( 'wpseo_titles' ); $title = $titles['title-ptarchive-POST_TYPE']; echo apply_filters( 'the_title', $title ); Remember to replace POST_TYPE by your own Custom Post Type. To display all the wpseo_title variables, you can use: printf( '<pre&...


11

Unless the plugin has made significant database changes, you could follow these steps to downgrade it: Download and extract the old version from the plugin repository Disable the plugin Log on to your server with FTP or SSH Upload the old plugin directory to wp-content/plugins/. (You would want to overwrite the newer version.) Reactivate the plugin Here's ...


10

For reference the file that handles the tracking and usage statistics for Yoast SEO is located at, path/to/wp-content/plugins/wordpress-seo/admin/class-tracking.php I have linked to the GitHub repository file in question for further inspection upon which you can see somewhat, relatively, harmless collection of data. However what you determine as "...


7

To add a page number regardless to any plugin … use filters. Do not change the plugin file. You cannot run updates other wise. Example: <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Add page number to title * Description: Adds <code> | Page $number</code> to the page title. * License: MIT * License URI: http://www.opensource....


6

A simple way to achieve this (but without the Class approach) is by filtering the output of wp_head action hook using the output buffering. In your theme's header.php, wrap the wp_head() call with ob_start($cb) and ob_end_flush(); functions like: ob_start('ad_filter_wp_head_output'); wp_head(); ob_end_flush(); Now in theme functions.php file, declare your ...


6

It appears that your site doesn't use the core WordPress Featured Image feature but instead uses a custom image field (probably from Advanced Custom Fields). Yoast's plugin, Jetpack, and presumably many others look for the Featured Image image when setting the opengraph meta tag. So you have two options: Use the core Featured Image feature with one of the ...


5

On archive page in post loop add following line of code to make it work echo get_post_meta(get_the_ID(), '_yoast_wpseo_title', true); Tell me whether it is working for you or i will provide another solution.


5

Looking at the filter: $post_content = apply_filters( 'wpseo_pre_analysis_post_content', $post->post_content, $post ); it would be a matter of adding your fields content to string being analyzed. You have to do the get_field() part right, this is untested: add_filter( 'wpseo_pre_analysis_post_content', 'filter_yoasts_wpse_119879', 10, 2 ); function ...


4

In the source code I see two og:description meta tags. The first and correct one seems to be coming from your Yoast WordPress SEO Plugin. The other one is outside the plugin's block, so I guess it's defined elsewhere. Check your theme if it includes that meta tag. If not, check your other plugins. Disable them one by one to find the culprit.


4

ASCII characters will not cause any issues with search engines and they will be displayed properly. SEOmoz does this to avoid any chance of sql injection via its form fields.


4

Yoast uses wp_head hook to output the meta description tag. Make sure you have this line in your <head>: <?php wp_head(); ?> For title tag, you can simplify the code by using one function call: <?php wp_title( '|', true, 'right' ); ?> The wp_title uses a filter (same name wp_title) to let users change the title tag. And Yoast uses this ...


4

Try pasting this in a plugin or theme functions.php file, as per the WordPress SEO plugin (API Docs), by Yoast. if(function_exists('wpseo_use_page_analysis') && !current_user_can('administrator')){ add_filter('wpseo_use_page_analysis', '__return_false'); } To avoid any errors... This checks to make sure the function exists, before attempting to ...


4

You can remove it using the remove_meta_box function. if ( ! current_user_can( 'edit_pages' ) ) { add_action( 'add_meta_boxes', 'my_remove_wp_seo_meta_box', 100000 ); } function my_remove_wp_seo_meta_box() { remove_meta_box( 'wpseo_meta', 'post', 'normal' ); } Notice the 100000 in the add_action, this makes sure that this is done after the WP SEO ...


4

Thanks for all your help, i finally resolved it. I created a functions.php for my child theme, then add // we get the instance of the class $instance = WPSEO_Frontend::get_instance(); /* then we remove the function You can remove also others functions, BUT remember that when you remove an action or a filter, arguments MUST MATCH with the add_action ...


4

This should hide it for everyone but the admin. If you run into any issues, you can use a plugin like Advanced Access Manager to get the job done. With that you will have more control of what each user level has access to. function hide_yoastseo() { if ( !current_user_can( 'administrator' ) ) : remove_action('admin_bar_menu', 'wpseo_admin_bar_menu',95); ...


4

Maybe this isn't the best method because it does give an editor access to Settings and Options, but what this does is gives the a specific editor (based on user ID) the permissions to edit options. We then test if we're loading one of the options template, if we are AND the user id is the same id we've given permissions to, kill the process and spit out a ...


4

The best way to change the capability that users need to view the Yoast SEO settings pages is by using the wpseo_manage_options_capability filter. Here's an example of how this is used (placed in your functions.php file): /** * Return the capability that users need to view the Yoast SEO settings pages. * * @return mixed|void */ function ...


4

You might think it's 39 characters long, but it's actually 332 characters long. This is the real URL you're trying to use: https://sitename.com/%D8%A8%D8%B1%D9%85%D8%AC%D8%A9-%D8%AA%D8%B5%D9%85%D9%8A%D9%85-%D9%85%D9%88%D9%82%D8%B9-%D9%85%D8%B1%D9%83%D8%B2-%D8%B1%D9%81%D8%B9-%D8%AA%D8%AD%D9%85%D9%8A%D9%84-%D8%AA%D8%B7%D8%A8%D9%8A%D9%82-%D8%AA%D8%B7%D8%A8%D9%...


3

Within the pages "Wordpress SEO by Yoast" meta box, open the "Advanced" tab and set the "Meta Robots Index". It took me forever to find this as well.


3

Throw this into your functions.php: function clear_yoast_metadesc( $metadesc ) { return ''; } add_filter( 'wpseo_metadesc', 'clear_yoast_metadesc', 99, 1 ); If you set the $metadesc to empty like that, it won't be echoed. BTW, bulk editing is very hard on my to-do list, so you would be able to switch back completely :)


3

You will want to make use of Yoast SEO's "WPSEO_Frontend" class. To display the meta description field content, you could do the following: <?php if (class_exists('WPSEO_Frontend')) { echo WPSEO_Frontend::metadesc(false); } ?>


3

Solution: <?php $object = new WPSEO_Frontend(); echo $object->metadesc( false ); ?>


3

I don't think you are going to be able to do that using remove_action. The function argument in remove_action will not help you as the debug_marker() function was not the function that was used in the add_action() call. Yoast presumably has something like add_action( "wp_head", "head" ) in his code. So you can remove the "head" function, but debug_marker ...


3

You do not need to add Yoast if you only want to add meta tags to the homepage. Just some minor editing will save you on performance. You can use the is_home() function. Insert this to your header.php: <?php if (is_home()) { ?> <meta name="description" content="Your description for homepage..." /> <?php } else { ?> <meta name="...


3

You can use the wpseo_title filter to read the tag for your site title after WPSEO creates it, and if it's not there, add it on. add_filter( 'wpseo_title', 'wpse137502_wpseo_title' ); function wpse137502_wpseo_title( $title ) { $site_title = get_bloginfo( 'name' ); if ( ! strpos( $title, $site_title ) ) { $title .= " | " . $site_title; }...


Only top voted, non community-wiki answers of a minimum length are eligible