Meta Tag Manager - Version 2.3

Version Description

  • added multiple filters and actions for easier extension
  • added use of overridable MTM_Tag::get_content() during the output() method
  • fixed empty choice of post types resulting in 'Array' default selection value
  • fixed display/functionality issues of MTM editor in post editors when no custom post types are chosen for MTM inclusion on settings page
  • added facebook-domain-verification name type selection
Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Meta Tag Manager
Version 2.3
Comparing to
See all releases

Code changes from version 2.2 to 2.3

meta-tag-manager-admin.php CHANGED
@@ -55,7 +55,7 @@ class Meta_Tag_Manager_Admin {
55
  if($hook == 'post.php' || $hook == 'post-new.php' ){
56
  global $post;
57
  $mtm_custom = get_option('mtm_custom');
58
- if( !in_array($post->post_type, $mtm_custom['post-types']) ) return;
59
  }
60
  $jquery_deps = array('jquery','jquery-ui-core','jquery-ui-widget','jquery-ui-mouse','jquery-ui-sortable');
61
  if( defined('WP_DEBUG') && WP_DEBUG ){
55
  if($hook == 'post.php' || $hook == 'post-new.php' ){
56
  global $post;
57
  $mtm_custom = get_option('mtm_custom');
58
+ if( !empty($mtm_custom['post-types']) && !in_array($post->post_type, $mtm_custom['post-types']) ) return;
59
  }
60
  $jquery_deps = array('jquery','jquery-ui-core','jquery-ui-widget','jquery-ui-mouse','jquery-ui-sortable');
61
  if( defined('WP_DEBUG') && WP_DEBUG ){
meta-tag-manager.php CHANGED
@@ -4,12 +4,12 @@ Plugin Name: Meta Tag Manager
4
  Plugin URI: https://wordpress.org/plugins/meta-tag-manager/
5
  Description: A simple plugin to manage meta tags that appear on aread of your site or individual posts. This can be used for verifiying google, yahoo, and more.
6
  Author: Marcus Sykes
7
- Version: 2.2
8
  Author URI: http://msyk.es/?utm_source=meta-tag-manager&utm_medium=plugin-header&utm_campaign=plugins
9
  Text Domain: meta-tag-manager
10
  */
11
  /*
12
- Copyright (C) 2020 Marcus Sykes
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
26
  */
27
  if( !defined('ABSPATH') ) exit;
28
 
29
- define('MTM_VERSION', '2.2');
30
 
31
  class Meta_Tag_Manager {
32
  /** loads the plugin */
@@ -38,6 +38,7 @@ class Meta_Tag_Manager {
38
  require_once ( 'meta-tag-manager-admin.php' );
39
  }
40
  add_action ('wp_head', 'Meta_Tag_Manager::head', 1);
 
41
  }
42
 
43
  /** puts the meta tags in the head */
4
  Plugin URI: https://wordpress.org/plugins/meta-tag-manager/
5
  Description: A simple plugin to manage meta tags that appear on aread of your site or individual posts. This can be used for verifiying google, yahoo, and more.
6
  Author: Marcus Sykes
7
+ Version: 2.3
8
  Author URI: http://msyk.es/?utm_source=meta-tag-manager&utm_medium=plugin-header&utm_campaign=plugins
9
  Text Domain: meta-tag-manager
10
  */
11
  /*
12
+ Copyright (C) 2021 Marcus Sykes
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
26
  */
27
  if( !defined('ABSPATH') ) exit;
28
 
29
+ define('MTM_VERSION', '2.3');
30
 
31
  class Meta_Tag_Manager {
32
  /** loads the plugin */
38
  require_once ( 'meta-tag-manager-admin.php' );
39
  }
40
  add_action ('wp_head', 'Meta_Tag_Manager::head', 1);
41
+ do_action('metatagmanager_loaded');
42
  }
43
 
44
  /** puts the meta tags in the head */
mtm-admin-settings.php CHANGED
@@ -37,7 +37,7 @@ if (is_admin () and !empty($_REQUEST['mtm_nonce']) && wp_verify_nonce($_REQUEST[
37
  <div id="mtm-post-types" class="postbox mtm-post-types">
38
  <h2 class="hndle"><?php esc_html_e('Post Type Support', 'meta-tag-manager'); ?></h2>
39
  <div class="inside">
40
- <p><?php esc_html_e('Enable the meta tag builder on the edit pages of your selected post types below. This will allow you to create specific post types for specific posts on your site.', 'meta-tag-manager'); ?></p>
41
  <?php
42
  //Post Types
43
  $post_type_options = array();
@@ -57,6 +57,7 @@ if (is_admin () and !empty($_REQUEST['mtm_nonce']) && wp_verify_nonce($_REQUEST[
57
  <div class="mtm-menu-builder mtm-menu-group">
58
  <p><?php esc_html_e('Use the meta tag builder to create meta tags which will be used on your site. You can choose what kind of meta tag to display, as well as where to display them such as on all your pages, just the home page or specific post types and taxonomies.', 'meta-tag-manager'); ?></p>
59
  <p><?php esc_html_e('You can also enter a reference name at the top of each field card (something to help you remember the meta tag) and then enter the values below it that you want the meta tag to hold.', 'meta-tag-manager'); ?></p>
 
60
  <p><?php esc_html_e('For adding meta tags to specific post types, please click on the \'General Options\' tab above.', 'meta-tag-manager'); ?></p>
61
  <?php MTM_Builder::output(Meta_Tag_Manager::get_data(), array('context'=>true, 'reference'=>true)); ?>
62
  </div>
37
  <div id="mtm-post-types" class="postbox mtm-post-types">
38
  <h2 class="hndle"><?php esc_html_e('Post Type Support', 'meta-tag-manager'); ?></h2>
39
  <div class="inside">
40
+ <p><?php esc_html_e('Enable the meta tag builder on the edit pages of your selected post types below. This will allow you to create specific post types for specific posts on your site. Leave blank for all post types.', 'meta-tag-manager'); ?></p>
41
  <?php
42
  //Post Types
43
  $post_type_options = array();
57
  <div class="mtm-menu-builder mtm-menu-group">
58
  <p><?php esc_html_e('Use the meta tag builder to create meta tags which will be used on your site. You can choose what kind of meta tag to display, as well as where to display them such as on all your pages, just the home page or specific post types and taxonomies.', 'meta-tag-manager'); ?></p>
59
  <p><?php esc_html_e('You can also enter a reference name at the top of each field card (something to help you remember the meta tag) and then enter the values below it that you want the meta tag to hold.', 'meta-tag-manager'); ?></p>
60
+ <p><?php echo sprintf(esc_html__('Certain tag values for the "name" type such as %s cannot be repeated, and the last duplicate tag will take precendence unless there is a tag defined for the specific post type being viewed.', 'meta-tag-manager'), '<code>keywords, description</code>'); ?></p>
61
  <p><?php esc_html_e('For adding meta tags to specific post types, please click on the \'General Options\' tab above.', 'meta-tag-manager'); ?></p>
62
  <?php MTM_Builder::output(Meta_Tag_Manager::get_data(), array('context'=>true, 'reference'=>true)); ?>
63
  </div>
mtm-builder.php CHANGED
@@ -217,7 +217,7 @@ class MTM_Builder {
217
  }
218
  }
219
  }
220
- if( !preg_match('/selected="selected"/', $html) && $selected != '' && $add_selected_option ){
221
  //value not existing, so we add it as an option
222
  $html = '<option selected="selected">'.esc_html($selected).'</option>' . $html;
223
  }
217
  }
218
  }
219
  }
220
+ if( !preg_match('/selected="selected"/', $html) && !empty($selected) && $add_selected_option ){
221
  //value not existing, so we add it as an option
222
  $html = '<option selected="selected">'.esc_html($selected).'</option>' . $html;
223
  }
mtm-tag-admin.php CHANGED
@@ -34,7 +34,7 @@ class MTM_Tag_Admin extends MTM_Tag {
34
  if( empty(self::$type_options) ){
35
  $options = array(
36
  'name' => array(
37
- __('Common values','meta-tag-manager') => array( 'application-name', 'author', 'description', 'generator', 'keywords', 'referrer' ),
38
  __('Other possible values','meta-tag-manager') => array( 'creator', 'googlebot', 'publisher', 'robots', 'slurp', 'viewport')
39
  ),
40
  'http-equiv' => array( 'Content-Security-Policy', 'default-style', 'refresh' ),
34
  if( empty(self::$type_options) ){
35
  $options = array(
36
  'name' => array(
37
+ __('Common values','meta-tag-manager') => array( 'application-name', 'google-site-verification', 'facebook-domain-verification', 'author', 'description', 'generator', 'keywords', 'referrer' ),
38
  __('Other possible values','meta-tag-manager') => array( 'creator', 'googlebot', 'publisher', 'robots', 'slurp', 'viewport')
39
  ),
40
  'http-equiv' => array( 'Content-Security-Policy', 'default-style', 'refresh' ),
mtm-tag.php CHANGED
@@ -20,17 +20,21 @@ class MTM_Tag {
20
  }
21
 
22
  public function output(){
 
 
 
 
23
  $tag_string = '<meta '.esc_attr($this->type).'="'.esc_attr($this->value).'"';
24
  if( $this->has_content() ){
25
  if( $this->type == 'http-equiv' && $this->value == 'Link' ){
26
  //escape the attribute but allow for the <url>; format to pass through
27
- $tag_string .= ' content="'.preg_replace('/&lt;(.+)&gt;;/', '<$1>;', esc_attr($this->content)).'"';
28
  }else{
29
- $tag_string .= ' content="'.esc_attr($this->content).'"';
30
  }
31
  }
32
  $tag_string .= ' />';
33
- return $tag_string;
34
  }
35
 
36
  public function to_array(){
@@ -60,6 +64,10 @@ class MTM_Tag {
60
  return false;
61
  }
62
 
 
 
 
 
63
  public static function get_types(){
64
  if( empty(self::$types) ){
65
  self::$types = apply_filters('mtm_tag_get_types', array('name','http-equiv','charset','itemprop','property'));
20
  }
21
 
22
  public function output(){
23
+ $output = apply_filters('mtm_tag_output_pre', null, $this);
24
+ if( $output !== null ){
25
+ return apply_filters('mtm_tag_output', $output, $this);
26
+ }
27
  $tag_string = '<meta '.esc_attr($this->type).'="'.esc_attr($this->value).'"';
28
  if( $this->has_content() ){
29
  if( $this->type == 'http-equiv' && $this->value == 'Link' ){
30
  //escape the attribute but allow for the <url>; format to pass through
31
+ $tag_string .= ' content="'.preg_replace('/&lt;(.+)&gt;;/', '<$1>;', esc_attr($this->get_content())).'"';
32
  }else{
33
+ $tag_string .= ' content="'.esc_attr($this->get_content()).'"';
34
  }
35
  }
36
  $tag_string .= ' />';
37
+ return apply_filters('mtm_tag_output', $tag_string, $this);
38
  }
39
 
40
  public function to_array(){
64
  return false;
65
  }
66
 
67
+ public function get_content(){
68
+ return apply_filters('mtm_tag_get_content', $this->content, $this);
69
+ }
70
+
71
  public static function get_types(){
72
  if( empty(self::$types) ){
73
  self::$types = apply_filters('mtm_tag_get_types', array('name','http-equiv','charset','itemprop','property'));
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Meta Tag Manager ===
2
  Contributors: netweblogic
3
- Tags: google, SEO, yahoo, tags, webmaster tools, meta, meta tags, ogp, open graph, twitter cards
4
  Text Domain: meta-tag-manager
5
  Requires at least: 3.6
6
- Tested up to: 5.7
7
- Stable tag: 2.2
8
 
9
  Easily add and manage custom meta tags to various parts of your site or on individual posts, such as Yahoo and Google verification tags.
10
 
@@ -69,6 +69,13 @@ Please visit our <a href="https://wordpress.org/support/plugin/meta-tag-manager"
69
  3. If enabled you can add meta tags to a specific post in it's own meta box
70
 
71
  == Changelog ==
 
 
 
 
 
 
 
72
  = 2.2 =
73
  * updated jQuery scripts to remove deprecated functions in jQuery 3.5
74
  * updated selectize.js library to 0.13.3
1
  === Meta Tag Manager ===
2
  Contributors: netweblogic
3
+ Tags: google, SEO, yahoo, tags, webmaster tools, meta, meta tags, meta-tags, og, ogp, open graph, twitter cards
4
  Text Domain: meta-tag-manager
5
  Requires at least: 3.6
6
+ Tested up to: 5.8.1
7
+ Stable tag: 2.3
8
 
9
  Easily add and manage custom meta tags to various parts of your site or on individual posts, such as Yahoo and Google verification tags.
10
 
69
  3. If enabled you can add meta tags to a specific post in it's own meta box
70
 
71
  == Changelog ==
72
+ = 2.3 =
73
+ * added multiple filters and actions for easier extension
74
+ * added use of overridable MTM_Tag::get_content() during the output() method
75
+ * fixed empty choice of post types resulting in 'Array' default selection value
76
+ * fixed display/functionality issues of MTM editor in post editors when no custom post types are chosen for MTM inclusion on settings page
77
+ * added facebook-domain-verification name type selection
78
+
79
  = 2.2 =
80
  * updated jQuery scripts to remove deprecated functions in jQuery 3.5
81
  * updated selectize.js library to 0.13.3