WordPress.org

Make WordPress Core

Ticket #18558: shortcodes.php

File shortcodes.php, 1.3 KB (added by trevogre, 3 years ago)
Line 
1### Eclipse Workspace Patch 1.0
2#P Shortcode Patch Development
3Index: wp-includes/shortcodes.php
4===================================================================
5--- wp-includes/shortcodes.php  (revision 18627)
6+++ wp-includes/shortcodes.php  (working copy)
7@@ -43,6 +43,21 @@
8 $shortcode_tags = array();
9 
10 /**
11+ * Retrieving array of all shortcodes previously run and saved to point to a output a default shortcode
12+ * which does nothing more that return the $content passed to the shortcode.
13+ */
14+add_option('wp_shortcodes', array(), '', 'yes');
15+$shortcode_tags = get_option('wp_shortcodes');
16+
17+/**
18+ * Blank shortcode which outputs nothing but the $content for all shortcodes whose code no longer exists.
19+ *
20+ * @param array $atts
21+ * @param string $content
22+ */
23+function unregistered_shortcode($atts = null, $content = null) { return $content; }
24+
25+/**
26  * Add hook for shortcode tag.
27  *
28  * There can only be one hook for each shortcode. Which means that if another
29@@ -95,6 +110,11 @@
30 
31        if ( is_callable($func) )
32                $shortcode_tags[$tag] = $func;
33+               $shortcode_registrations = $shortcode_tags;
34+               foreach($shortcode_registrations as $k => $v) {
35+                       $shortcode_registrations[$k] = "unregistered_shortcode";
36+               }
37+               update_option('wp_shortcodes', $shortcode_registrations);       
38 }
39 
40 /**