I figured it out myself.
function generate_the_excluded_array() {
global $excluded_pages;
$excluded_pages = array('Foo', 'Bar');
}
add_action( 'after_setup_theme', 'generate_the_excluded_array' );
And then it can be ‘imported’ using the global
, as such:
function example_shortcode_definition() {
global $excluded_pages;
echo $excluded[0];
}
add_shortcode( 'example_shortcode', 'example_shortcode_definition' );
Related Posts:
- How to: inspect global variables in WordPress
- get_post() vs global $post or $GLOBAL[‘post’]
- How to deal with global information without creating a Singleton class
- Using global $post v/s $GLOBALS[‘post’]
- Accessing $post global on a custom post type archive page
- get_query_var vs global query variables?
- What is the global $wp object used for?
- Change global values from templates
- Will $current_user no longer be global?
- How to avoid repeatedly use the new statement to instantiate a class? [closed]
- Is $page a global variable in wordpress?
- How can i use a global variable in a .css file generated with php?
- Current page id returns the incorrect value
- Echo get_the_category() outside of loop (global?)
- How does WordPress make its functions globally available?
- Recommendations on accessing current user data in WordPress
- WP user agent returns random variables
- How to get particular data from wp_list_comments outside the loop?
- How to save a viewer specific option
- What is the correct way to obtain access to the WP_oEmbed object?
- $GLOBALS[‘value1’] is not working
- wp localize script makes variable global, how to solve that?
- using globals from wp_link_pages function
- How to set and use global variables? Or why not to use them at all
- WordPress Theme variables scope
- Any advantage of using wp_scripts and is_IE when enqueuing scripts
- Reducing the use of global $post
- Does an activated plugin automatically mean its methods are available to other WP functions?
- Where to get information about array fields in $_REQUEST?
- Registering AJAX callback function that is part of a class without instantiating the class in function.php
- Filtered query_vars becomes global. Why does this work?
- query_posts() in function makes global $wp_query out of sync?
- Detecting Embed URLs Within post_content
- using 1 form shortcode (si or cf7) for all multisite sites [closed]
- How to access global $wp_meta_boxes variable on front-end?
- Multisite Installation: how do I setup global search?
- global $wp_meta_boxes returns NULL
- Save last login date in global before change it?
- How to check if this is the nth instance of a given shortcode in a post
- store custom WP table names in a global variable
- WP 4.4.1 allow empty comments via add_action ‘pre_comment_on_post’
- Adding a section to admin menu for global settings
- Using query_posts inside single.php loop
- after_setup_theme, Global Variable and Theme Customizer
- How/where is the global variable $wp_registered_widgets filled?
- Using global $post; to get featured image for custom post via WP_Query
- Call External Object in Class Function During Callback
- Ajax Pagination on Ajax filter
- How to make global post work with custom post type?
- Getting $curauth->ID to work inside a shortcode
- Result of API Request to global variable?
- What is the proper method of using global $post?
- global variables in templates
- How to modify a global variable in a function and use it on another function?
- Global $post shows null in some of my custom post types archive pages
- How can I save custom meta to one global value?
- How do I pass custom shortcode-extracted variables (taxonomy) into a query function for WordPress RoyalSlider?
- Global Variable vs Local Variable
- What does the Global Variable $s represent?
- Get current page id, title, url, etc
- What’s the safest way to switch and restore a post global?
- How to Use Global Variables Inside Header and Footer
- What is the alternative code to if (isset ($_POST) && !empty ($_POST) to avoid warnings?
- Getting the teaser text without overriding global variables
- Array is not working in Filter?
- how to load posts to a custom post template after using template_redirect or template_include
- Access post ID in “content_save_pre”
- Php file that doesn’t recognize wordpress functions
- What’s the right way to share data between widgets?
- Display Post Meta in Header
- how do i register global query in template
- Is a multisite install what I need?
- The $post variable – Did I get the grasp of how the Backend actions get parsed?
- How to show avatar of current logged in user in a widget
- Difference between $numpages & $max_page on archive pages
- How can I globally italicize list of texts in the UI database or Posts? [closed]
- Pass global variable from Page 1 to page 2 (Pagination)
- Global $post returns 2 objects for my shortcode
- Woocommerce Multisite global search how to mod ajax function?
- External api call and make global variable for any page visitor enters , page-home, page, single etc
- Insert variables into wpdb in custom post template
- Browser detection booleans mess. Caché plugin?
- Trying to get property ‘post_content’ of non-object
- How to access custom class methods from any include without using global
- Ajax global variable is not getting saved (returns null)
- Global page ID variable empty error
- I need some explanation on global $post [duplicate]
- Get variable from previous blog while using switch_to_blog
- Need data from two different actions
- global categories – Share specific categories in wordpress multisite
- Use a select box to change a php variable
- Popup panel is only displaying 1 entry ignoring all others
- Best way to access variables in template markup
- Add notice to add image popup
- How to load post_meta for custom post type via Ajax
- Sessions in plugin development?
- $GLOBALS & global doesn’t work [closed]
- Suppress errors when using global function
- Using global variables
- How can one use variables in a template or template part without polluting the global scope?