How to loop through yoast primary categories? [closed]

Managed to sort it, the primary category is added as post meta to the post, therefore you can pass through the following arguments: ‘meta_key’ => ‘_yoast_wpseo_primary_news-category’, ‘meta_value’ => 1179, Note: your meta key will be different since this is a custom taxonomy that I have set up, if you print the get_post_meta for your posts, … Read more

Remove all stop words from old permalinks

This script will do the job: function wpse_287807_replace_url() { // Get all posts $query = new WP_Query(array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, )); $posts = $query->get_posts(); foreach ($posts as $post) { // Get permalink $url = $post->post_name; // Stop words array $stop_words = array( ‘-a-‘, ‘-the-‘, ‘-of-‘, ); // Replacement $replacement=”-“; // Replace url … Read more

Export Yoast Keywords from MySQL/phpMyAdmin

This query pulls the post id, title, permalink, and focus keywords. You could modify this to pull the post meta description and title as well if you wanted. Change post_type to page if you want to pull pages. SELECT wpp.post_title, wpp.ID, wpp.post_date, mt1.meta_value as focus_keyword, REPLACE( REPLACE( REPLACE( REPLACE( wpo.option_value, ‘%year%’, DATE_FORMAT(wpp.post_date,’%Y’) ), ‘%monthnum%’, DATE_FORMAT(wpp.post_date, … Read more

Is there a straight-forward way to provide a meta description tag via Yoast SEO, programmatically, without relying on the admin panel?

Way overthinking it: <?php add_filter(‘wpseo_opengraph_desc’, function () use (&$data) { $seo_intro = trim($data->seo_intro); if ($seo_intro === ”) { $seo_intro = “{$data->name} – {$data->title}”; } return esc_attr(wp_strip_all_tags(stripslashes(do_shortcode($seo_intro)))); }, PHP_INT_MAX); ?> Essentially, hijack the content with a filter (since that’s what Yoast is using to derive the description) and make sure it’s the last filter to be … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)