WordPress.org

Forums

Yoast SEO
[resolved] [Plugin: WordPress SEO by Yoast] How to show Images only for posts? (2 posts)

  1. Ervald
    Member
    Posted 3 years ago #

    I'm only interested to show images for Posts,
    when I activate Add images to XML Sitemap.

    Images show in Pages, Posts and Custom Type Posts.

    How do I show them only for Posts?

    Thanks in advance.

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. Ervald
    Member
    Posted 3 years ago #

    Here's how you do this.

    Wordprpress Seo 1.0.3

    class-sitemaps.php: Line 312

    Find
    if ( $images_in_sitemap ) {
    Change with

    $post_type = get_post_type($p->ID);
    $images_in_sitemap = isset($options['xml_include_images']) && $options['xml_include_images'];
    if ( $images_in_sitemap && $post_type == 'post' ) {

    To set a checkbox option for admin.
    class-config.php:

    Add after Line 996
    $content .= $this->checkbox('xml_include_images', __("Add images to XML Sitemap."), false);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic