I don’t know if this is the right way but by reading here , I have tried the following : added a global $MyObject in functions.php just before I create the object, and then put a global $MyObject in the header-menu.php file. This works : the object is now visible.
Unless someone knows a drawback doing this, this could be the answer…
Related Posts:
- Should all plugins be encapsulated in a Class?
- Registering Class methods as hook callbacks
- Get plugin_dir_url() from one level deep within plugin
- How to use classes declared in another plugin?
- Namespaces in WordPress – How do I initiate the main class?
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Adding an admin page – OOP approach not working
- scheduled event not getting executed
- Using the media uploader in a custom plugin
- How can I add a custom header to a custom template in a plugin without using the theme folders
- Trying to get logged-in user data inside php class
- register child class in another plugin
- Check if a class exists within a method
- How to include and use custom class files in plugin?
- Creating a menu page in a Object Oriented developed plugin
- Current user in plugin returns NULL
- How to structure a plugin into multiple files using classes?
- adding meta data using plugin to top of head
- Override WP Class Private Function
- Calling custom plugin class methods from a template
- Getting user roles in plugin files
- Plugin activation hook in an abstract class
- Create mobile navigation header with settings integration
- plugin class inheritance. cannot change variable
- Headers Content-Security-Policy CSP Major Issue
- Most efficient way to use classes to create admin pages using Settings API
- Basic Object Oriented plugin question
- Using plugin functions/methods within templates
- How to handle cookies from a WordPress plugin on a cached page?
- accessing parent variables in child construct without executing action in parent
- Object method calling for global $wpdb in header.php
- Why is my custom post type not being activated on plug-in activation?
- How to prevent PHP fatal error if plugin hasn’t been enabled and a method is called in theme file?
- get_option / wp_localize_script Not Working in OOP Plug In
- Built a second plugin but it overwrote the first one
- profile_update hook doesn’t works inside a class
- WordPress Object Oriented plugin development [closed]
- How to access OOP plugin function inside themes or other plugin
- Plugin: Hooking up classes that have their own hooks
- WordPress Custom Hook with Class method
- FPDF for creating pdf diplomas
- WordPress plugin blog creation
- Woocommerce functions in custom class, avoid errors
- Get post content inside plugin class method
- How to access classes in theme of a plugin?
- Reorganization of namespaces
- Creating a register settings class that supports extended classes
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Why function hooked using object are executing at all time?
- How do add_action and WP_Query
- private functions in plugins
- Plugin won’t activate, fatal error (widget class not found)
- OOP Plugin: Where should I place the action hooks in the class?
- Global Handle to Class unavailable in Plugin?
- How to laod wp_enqueue_style to another header i created my self
- Strict Standards: Non-static method in sidebar generator
- Plugin: Custom menu item problem
- Function not being called on form submit, only blank admin-post.php page
- Is it possible to use Classes between WordPress plugins with separate namespaces?
- Loading external page template and enqueue script from plugin causes 403 forbidden error
- How to properly secure my WordPress installation?
- Is it necessary to translate WordPress key terms when localizing a plugin
- How to edit/delete single row items in a table on my own menu page
- How to create custom embed block in gutenberg wordpress
- How to add css class to a specific set of images?
- WooCommerce E-Check payment gateway disappeared when site switched to multi-site
- How can sanitize $_FILES[‘haq_slider’] field
- Wp favorite posts get user favorites in profile using buddypress [closed]
- Preferred way of cacheing a value in php
- Internationalization autocomplete JS variable
- Howto accurately position images with maximum flexibility?
- wp_remote_get() returns 403 while file_get_contents() does not
- Create a multisite network for an existing installation
- polylang + category/tag custom language link
- Paypal Integration [closed]
- Remove hovercard for only certian gravatars
- Is there a loading priority for login_enqueue_scripts?
- How to apply lazy loading in background images [closed]
- How can I test plugin activation using phpunit?
- WordPress custom taxonomy not showing
- Getting a Page via its post-name using WP REST API v2 and Postman
- Software to run on server checking outdated wordpress installations
- Integrating boxtal PHP library into a custom WordPress Plugin
- Test my WordPress Plugin standard or not
- Modifying post titles on pages, archives and single but not dashboard/admin
- Every time I save my plugin options it erases another plugin options
- is there a way to pass a parameter to a add_menu_page function?
- How can I replace content on site generated from plugin without changing plugin
- TranslatePress | secondary language category/sub-category not working correctly “`/%category%/%postname%/“`
- Need to know if my approach to designing a geneaology plug-in for wordpress makes sense
- Live Streaming with WordPress?
- How to edit checkout page? [closed]
- How to access custom post meta data from JavaScript
- All plugins deactivated. What could cause this?
- Variable passed to each() is not an array
- Upload images on 3D shape by customers
- how to restore one day before deleted data in wordpress?
- Sanitizing, Validating , etc (Plugin)
- How to Save Category and Delete Category in same Function
- My site has only one page, and users access my uploaded mp3 files from there – can I analyze access by song title?