PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.7.2
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.7.2
2.7.1 2.7.2 2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 All 141 releases
metasync / includes / sitemap-taxonomy-picker.php

sitemap-taxonomy-picker.php in Search Atlas SEO – OTTO AI SEO Automation for WordPress 2.7.2, at includes/sitemap-taxonomy-picker.php

63 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Helpers for the taxonomy selector on the XML sitemap settings page.
4 *
5 * @package Metasync
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 if (!function_exists('metasync_get_sitemap_taxonomy_picker_taxonomies')) {
13 /**
14 * Filter registered taxonomies to the ones suitable for the sitemap picker.
15 *
16 * @param array $taxonomies Public taxonomy objects returned by WordPress.
17 * @return array Taxonomy objects that can be selected in sitemap settings.
18 */
19 function metasync_get_sitemap_taxonomy_picker_taxonomies($taxonomies) {
20 $excluded_taxonomies = [
21 'product_shipping_class',
22 'link_category',
23 'nav_menu',
24 'wp_pattern_category',
25 'template_tag',
26 'template_bundle',
27 ];
28
29 if (!current_theme_supports('post-formats')) {
30 $excluded_taxonomies[] = 'post_format';
31 }
32
33 $filtered_taxonomies = [];
34 foreach ((array) $taxonomies as $taxonomy) {
35 if (!is_object($taxonomy) || empty($taxonomy->name)) {
36 continue;
37 }
38
39 if (in_array($taxonomy->name, $excluded_taxonomies, true)) {
40 continue;
41 }
42
43 if (!is_taxonomy_viewable($taxonomy)) {
44 continue;
45 }
46
47 $filtered_taxonomies[] = $taxonomy;
48 }
49
50 /**
51 * Allow integrations to remove additional taxonomies from the picker.
52 *
53 * @param array $filtered_taxonomies Taxonomies that passed the defaults.
54 * @param array $taxonomies Original public taxonomy objects.
55 */
56 return apply_filters(
57 'metasync_sitemap_taxonomy_picker_taxonomies',
58 $filtered_taxonomies,
59 $taxonomies
60 );
61 }
62 }
63