Improved sitemap queries to be more resilient

Before, it was possible for chapters to not be included if a database field did not exist, which was dumb.
This commit is contained in:
Tetrakern 2023-06-13 11:21:44 +02:00
parent 6cc22dbb7c
commit 91cc419ccd

View File

@ -168,7 +168,7 @@ if ( ! function_exists( 'fictioneer_create_sitemap' ) ) {
array(
'key' => 'fictioneer_story_hidden',
'compare' => 'NOT EXISTS'
),
)
)
)
);
@ -192,8 +192,17 @@ if ( ! function_exists( 'fictioneer_create_sitemap' ) ) {
'orderby' => 'date',
'order' => 'DESC',
'numberposts' => '10000',
'meta_key' => 'fictioneer_chapter_hidden',
'meta_value' => '0'
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'fictioneer_chapter_hidden',
'value' => '0'
),
array(
'key' => 'fictioneer_chapter_hidden',
'compare' => 'NOT EXISTS'
)
)
));
set_transient( 'fictioneer_sitemap_chapters', $chapters );
}