htaccess: Remove trailing slash from URL ending with .xml/ only

If you’re outputting a sitemap, there’s no reason to wait for the query for your page- which is what is producing the redirect. Hook an earlier action and you won’t need anything to counter the trailing slash, because it won’t happen- EDIT Here’s a complete version with registering query vars, rules, and parse_request action: // … Read more

SEO meta description and title tag Yoast SEO

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 … Read more

How to use Yoast SEO backend in english even if WPLANG variable is not english?

That plugin loads its language the moment its main file is included: load_plugin_textdomain( ‘wordpress-seo’, false, dirname( plugin_basename( __FILE__ ) ) . ‘/languages’ ); So when your locale filter is used, the language is already there. :/ Move your small plugin into the mu-plugins directory. You can create it if it doesn’t exists in wp-content. That … Read more

Yoast SEO breadcrumbs: how to create a filter that uses the url slug for breadcrumb titles

Yoast does have a filter for you to use. See here: https://gist.github.com/jmcclellan/b2d97ffee0e924e28fa1 I used this to add “parent” pages to custom post types. We wanted to use pages as our category landers w/ custom post types as children. Yoast would not output the parent page slug by default since there is technically no real relationship, … Read more

add post content in meta description in yoast

Here is a safe and Yoast preferred method add_action(‘wp_head’,’add_custom_meta_description_box’); function retrieve_var1_replacement( $var1 ) { global $post; return strip_tags($post->post_content); } function register_my_plugin_extra_replacements() { wpseo_register_var_replacement( ‘%%mycustomdesc%%’, ‘retrieve_var1_replacement’, ‘advanced’, ‘this is a help text for myvar1’ ); } add_action( ‘wpseo_register_extra_replacements’, ‘register_my_plugin_extra_replacements’ ); You can now replace your %%excerpt%% with %%mycustomdesc%%

Inserting Post Using wp_insert_post. How to Fill Yoast Plugin SEO Fields

You can use the update_post_meta function to insert the Yoast Plugin data. Yoast uses 3 post meta keys for each post: _yoast_wpseo_title ( use for SEO title ) _yoast_wpseo_focuskw (For meta keywords ) _yoast_wpseo_metadesc (For meta descriptio ) You can find all these meta key under postmeta table $new_id = wp_update_post($array); update_post_meta( $new_id, ‘_yoast_wpseo_title’, ‘SEO … Read more

Exclude custom post_type in sitemap generation?

If you are using functions.php script to register custom post type, you should declare false to ‘has_archive’ => true,. function custom_post_type() { $labels = array( … ); $args = array( // you have to set it to False. ‘has_archive’ => false, ); register_post_type( ‘post_type’, $args ); } add_action( ‘init’, ‘custom_post_type’, 0 );

Manipulating wp_head content

Information attached to the wp_head action hook is echoed (if it needs to be echoed) as it occurs. There is no “wp_head” content string that you can search and replace. You will need to find the callback functions/methods for the data you are interested in manipulating and hope that there hooks built in that will … Read more

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