Making WordPress.org

Changeset 13070


Ignore:
Timestamp:
12/19/2023 03:11:43 AM (9 months ago)
Author:
dd32
Message:

Handbooks: Include handbooks in Jetpack Sitemaps.

See #6427.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/handbook.php

    r13045 r13070  
    192192        add_filter( 'wp_nav_menu_objects',                [ $this, 'highlight_menu_handbook_link' ] );
    193193        add_filter( 'display_post_states',                [ $this, 'display_post_states' ], 10, 2 );
     194        add_filter( 'jetpack_sitemap_post_types',         [ $this, 'jetpack_sitemap_post_types' ] );
    194195    }
    195196
     
    760761    }
    761762
     763    /**
     764     * Include handbooks in Jetpack Sitemaps (if enabled).
     765     *
     766     * @param array $post_types The post types for inclusion in sitemaps.
     767     * @return array
     768     */
     769    public function jetpack_sitemap_post_types( $post_types ) {
     770        if ( ! in_array( $this->post_type, $post_types ) ) {
     771            $post_types[] = $this->post_type;
     772        }
     773
     774        return $post_types;
     775    }
    762776}
Note: See TracChangeset for help on using the changeset viewer.