Simple solution- use GLOBAL variables..
$GLOBALS['my_categories_list'] = array(1,2,3,4);
then you can everywhere access $GLOBALS['my_categories_list']
.
Related Posts:
- Best way of passing PHP variable between partials?
- Custom page with variables in url. Nice url with add_rewrite_rule
- How Can I Access a PHP Variable in Another PHP Function
- Is it better to assign functions like get_the_id() to a variable if it’s used multiple times?
- Assigning WP functions which echo to PHP variables
- Passing values from a widget to a function within a plugin
- Using $themename Variables
- How to pass variables from a function in functions.php to an other one
- Define PHP variable from a seperate API if statement
- problem loading stylesheets to wp_head dynamically
- Undefined variable error in new function
- add_menu_page() with variable function
- Do I Need to Prefix Variables Inside Functions?
- Updating custom query var with multiple values
- Change Page Title
- get variables data from functions.php to template wordpress (without global variables)
- Getting value of variable from functions.php and debugging it
- Pass post ID from archive template to functions file
- How to access custom class methods from any include without using global
- Using a variable in name of dynamically-called helper function
- Setting a cookie in functions.php and it gets deleted when working on an other function
- getExcerpt: Make ellipsis appear only if character limit is reached
- Using Output from one Function and calling it into another
- How do I access variables outside a function [closed]
- Trying to get this function to show below the content
- add variable to actions/functions across different files (woocommerce)
- What’s the difference between WordPress random_int() and PHP built-in function random_int()?
- Is it ok to use a function to output the text domain name in a wordpress theme
- Issue with wp_get_attachment_image() and SVG file type
- deregister scripts on certain page
- How to get an array of menu items from the toolbar?
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Using get_terms for custom taxonomy in functions.php
- How to remove the embed_footer?
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Hide some items from Screen options in dashboard for products
- Editing or filtering the output of the Genesis navigation
- edit role display name and label name without plugins
- is_plugin_active() not properly returning true
- Display gallery on top before content
- List of Body Classes Generated by body_class()
- Converting html to wordpress images not showing
- Redirect specific page in WordPress for first time visit
- How can I add text to all posts/pages/categories/homepage etc
- Related post using post title
- Move Post to different category if post_meta field is 0 or is 2 days old?
- Excerpts are not displayed by a shortcode on category pages
- Getting comment count per post not working
- Functions.php Problem
- It does not work concatenation in function.php
- How would I go about replacing this function in my child theme located in inc/template-tags.php
- Condition OR for current user ID
- Retrieve a value from Yoast SEO to use to set a default twitter card image honoring overrides
- If user is logged-in display/hide something
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- Adding javascript to functions.php causes problems with my template
- Where do I store custom functions that call custom page template files?
- Excerpt for pages not showing
- How can I add a class to a nav li depending on URL?
- Access category within rss2_head hook?
- How to Extend login session times to a Month
- Modifying the_posts_pagination from within functions.php instead of template files
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- Prevent WordPress Automatic Logout
- functions php file [closed]
- How to add array [closed]
- How add body_class from wp_termmeta
- remove_action not working, even after changing priority [duplicate]
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- Modify function to only return values for the user that’s logged in
- WordPress performance – send all metaboxes to function or to call it again
- Add a class to post if it has been recently updated
- Change custom featured image size in twentythirteen child theme
- Theme Customizer – Custom Sections Display, but do Nothing
- WordPress comment processing . Default unapproved comments detection before posting
- Display a list of random terms from custom taxonomy with shortcode
- Text replace for the whole body tag
- wp enqueue style on about us page
- CF7 select value get to function and reciept value from function
- Remove nofollow from internal comment links via functions.php
- How can I automatically delete comments that contain a URL?
- Run function for specific user only
- Remove action hook from Class, understanding OOP
- Why is the term of my current page not returning a slug?
- Create custom admin bar menu items
- Adding a class to the body of an inactive site using multisite
- Conditionally apply css for a specific template part
- Fatal error: Call to undefined function. Underscore me
- Setting Active Nav item (of Pages) when you are on a Post with Category
- How to disable site title and description when custom header is uploaded on the customizer?
- How to list out all values from the get_body_class array
- Moving CDN jQuery to footer does not work?
- Function not recognizing page id?
- Register a widget area when a theme option has been saved?
- Blank child theme – functions.php problem
- Pull random comment from specific post, display on homepage with shortcode
- Hiding Google Analytics code based on theme options
- How do I make my child theme’s CSS update when I save it?
- function to show youtube videos within excerpt – if condition and apply_filters
- sort by date in users