PluginProbe
WPSSO Core – Complete Schema Markup and Meta Tags / 22.7.0
WPSSO Core – Complete Schema Markup and Meta Tags v22.7.0
22.7.0 22.6.1 22.6.0 22.5.3 22.5.2 22.5.1 22.4.0 22.3.0 22.2.1 22.2.0 22.1.3 22.1.2 22.1.1 22.1.0 22.0.0 21.13.3 21.13.2 trunk 21.13.1
← All changes | lib/meta-name.php +137 -0 22.4.022.7.0 View file →
@@ -1,0 +1,137 @@
1 +<?php
2 +/*
3 + * License: GPLv3
4 + * License URI: https://www.gnu.org/licenses/gpl.txt
5 + * Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/)
6 + */
7 +
8 +if ( ! defined( 'ABSPATH' ) ) {
9 +
10 + die( 'These aren\'t the droids you\'re looking for.' );
11 +}
12 +
13 +if ( ! defined( 'WPSSO_PLUGINDIR' ) ) {
14 +
15 + die( 'Do. Or do not. There is no try.' );
16 +}
17 +
18 +if ( ! class_exists( 'WpssoMetaName' ) ) {
19 +
20 + class WpssoMetaName {
21 +
22 + private $p; // Wpsso class object.
23 +
24 + public function __construct( &$plugin ) {
25 +
26 + $this->p =& $plugin;
27 +
28 + if ( $this->p->debug->enabled ) {
29 +
30 + $this->p->debug->mark();
31 + }
32 +
33 + add_action( 'wp_head', array( $this, 'maybe_disable_noindex' ), -1000 );
34 + }
35 +
36 + public function maybe_disable_noindex() {
37 +
38 + /*
39 + * WpssoUtilRobots->is_disabled() returns true if:
40 + *
41 + * - An SEO plugin is active.
42 + * - The 'add_meta_name_robots' option is unchecked.
43 + * - The 'wpsso_robots_disabled' filter returns true.
44 + */
45 + if ( ! $this->p->util->robots->is_disabled() ) {
46 +
47 + remove_action( 'wp_head', 'noindex', 1 );
48 +
49 + remove_action( 'wp_head', 'wp_robots', 1 );
50 + }
51 + }
52 +
53 + /*
54 + * Meta Name Tags.
55 + */
56 + public function get_array( array $mod, array $mt_og = array(), $author_id = false ) {
57 +
58 + if ( $this->p->debug->enabled ) {
59 +
60 + $this->p->debug->mark();
61 + }
62 +
63 + $mt_name = apply_filters( 'wpsso_meta_name_seed', array(), $mod );
64 +
65 + /*
66 + * Meta name "author".
67 + */
68 + if ( ! empty( $this->p->options[ 'add_meta_name_author' ] ) ) {
69 +
70 + if ( isset( $mt_og[ 'og:type' ] ) && 'article' === $mt_og[ 'og:type' ] ) {
71 +
72 + $mt_name[ 'author' ] = $this->p->user->get_author_meta( $author_id, 'display_name' );
73 +
74 + } elseif ( $this->p->debug->enabled ) {
75 +
76 + $this->p->debug->log( 'skipped author meta tag - og:type is not an article' );
77 + }
78 + }
79 +
80 + /*
81 + * Meta name "description".
82 + *
83 + * WpssoUtil->is_seo_desc_disabled() returns true if:
84 + *
85 + * - An SEO plugin is active.
86 + * - The 'add_meta_name_description' option is unchecked.
87 + */
88 + if ( ! $this->p->util->is_seo_desc_disabled() ) {
89 +
90 + $mt_name[ 'description' ] = $this->p->page->get_description( $mod, $md_key = 'seo_desc', $max_len = 'seo_desc' );
91 + }
92 +
93 + /*
94 + * Meta name "thumbnail".
95 + */
96 + if ( ! empty( $this->p->options[ 'add_meta_name_thumbnail' ] ) ) {
97 +
98 + $mt_name[ 'thumbnail' ] = $this->p->media->get_thumbnail_url( 'wpsso-thumbnail', $mod, $md_pre = 'og' );
99 +
100 + if ( empty( $mt_name[ 'thumbnail' ] ) ) {
101 +
102 + unset( $mt_name[ 'thumbnail' ] );
103 + }
104 + }
105 +
106 + /*
107 + * Baidu, Google, Microsoft Bing, Pinterest, and Yandex website verification IDs.
108 + */
109 + foreach ( WpssoConfig::$cf[ 'opt' ][ 'site_verify_meta_names' ] as $site_verify => $meta_name ) {
110 +
111 + if ( ! empty( $this->p->options[ 'add_meta_name_' . $meta_name ] ) ) {
112 +
113 + if ( ! empty( $this->p->options[ $site_verify ] ) ) {
114 +
115 + $mt_name[ $meta_name ] = $this->p->options[ $site_verify ];
116 + }
117 + }
118 + }
119 +
120 + /*
121 + * Meta name "robots".
122 + *
123 + * WpssoUtilRobots->is_disabled() returns true if:
124 + *
125 + * - An SEO plugin is active.
126 + * - The 'add_meta_name_robots' option is unchecked.
127 + * - The 'wpsso_robots_disabled' filter returns true.
128 + */
129 + if ( ! $this->p->util->robots->is_disabled() ) {
130 +
131 + $mt_name[ 'robots' ] = $this->p->util->robots->get_content( $mod );
132 + }
133 +
134 + return apply_filters( 'wpsso_meta_name', $mt_name, $mod );
135 + }
136 + }
137 +}