We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b762fe3 commit 78b068bCopy full SHA for 78b068b
inc/seo-compat.php
@@ -0,0 +1,31 @@
1
+<?php
2
+/**
3
+ * Simple Search Submission for IndexNow
4
+ *
5
+ * @package SimpleSearchSubmission
6
+ */
7
+
8
+namespace PWCC\SimpleSearchSubmission\SEOCompat;
9
10
11
+ * Determine if a post is set to noindex by an SEO plugin.
12
13
+ * @param \WP_Post|int $post The post object or ID.
14
+ * @return bool True if the post is set to noindex, false otherwise.
15
16
+function is_noindex( $post ) {
17
+ $post = get_post( $post );
18
+ if ( ! $post ) {
19
+ return true; // No post found, treat as noindex.
20
+ }
21
22
23
+ if ( class_exists( 'WPSEO_Meta' ) ) {
24
+ // Yoast SEO.
25
+ $meta_value = \WPSEO_Meta::get_value( 'meta-robots-noindex', $post->ID );
26
+ if ( '1' === $meta_value ) {
27
+ return true;
28
29
30
31
+}
0 commit comments