From b1e91f6cfbcfb1d9b49ceb0b06e3245537ca3052 Mon Sep 17 00:00:00 2001 From: Dan Lapteacru Date: Tue, 25 Oct 2022 14:17:51 +0300 Subject: [PATCH] helper function to get archive page id --- src/helpers.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/helpers.php b/src/helpers.php index b7c9d44..9930921 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -68,3 +68,15 @@ function is_search_page(): bool return get_the_ID() === $custom_search_page_id; } } + +if (! function_exists('get_archive_page_id')) { + /** + * @param string $postType + * + * @return int + */ + function get_archive_page_id(string $postType): int + { + return (int) get_option("page_for_{$postType}", 0); + } +}