The foolproof method here to grab a dynamic member variable is to use reflection!
Lets say we have this class:
class MyClass {
private $myProperty = true;
}
We can use reflection to acquire the class, and the property:
$class = new ReflectionClass("MyClass");
$property = $class->getProperty("myProperty");
We can then set that property to accessible:
$property->setAccessible(true);
Now we can access the private member variable using the new $property
object:
$obj = new MyClass();
echo $property->getValue($obj); // Works
Note, that the member variable is still private if we access it directly:
echo $obj->myProperty; // Error
However your code implies a static member variable, e.g.:
class Some_Plugin
private static $_some_property;
}
Which this may not work for
Related Posts:
- Include images from pages in wp search.php results in default wp search
- List events by month
- How to append element after thumbnail
- GravityForm: Populate Dropdown with custom post type [closed]
- Can’t get order_by meta_value_num to work properly
- If post has custom field then display css-class
- Replace text in post from cvs
- Make a custom_post translatable
- How To Post WordPress Custom Post Types to Twitter via IFTTT
- Pagination hitting 404 page on /page/4
- Filter content in shortcode
- Validate Custom Post Type fields
- Plugin Development using classes – Public & Private Callbacks
- Accessing download link from the loop with WP Download Manager Pro
- Set a template on a custom post in the plugin
- Custom Post Type works when registered in functions.php but not when registered in plugin
- Filter Custom Post Type Posts by Taxonomy
- Include images from pages in wp search.php results in default wp search
- How to display all custom fields associated with a post type – IN THE ADMIN AREA?
- WP_Query return highest number only
- Show custom taxonomy not in submenu
- Loop carousel slider in wordpress
- Meta Box not being added in plugin
- How to Fix WordPress 500 Internal server error due to custom post type
- How to hide home title on pages and posts?
- How do I programmatically add items of content to a custom post type?
- Separating Search Results By Post Type
- Change plugin’s has_archive = true to false?
- Custom post type loops with different page templates
- How can I programmatically save data into custom fields that contain serialized data?
- Row actions not showing? Why?
- Displaying custom post type on front page
- Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page
- Allow Users Access to Custom Post Type Only
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- How to have the right design for a custom post type without accessing themes
- Dynamic Custom Post Type Plugin
- How to filter out post type meta?
- Creating a custom post type using a object oriented approach?
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- Weird problem happening with custom taxonmy when creating/updating posts
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Get posts from a custom post type by child categories of a parent category
- How to retain $_POST data when submitting form to custom page
- Why get_posts() not returning only selected category posts from Custom Post Type?
- CPT + CMB2: data not displaying for only first post in loop
- Query & Order posts by custom fields
- ACF field key/value to show on taxonomy list
- Using custom field content as expression in IF statement [closed]
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- search suggest – filter post type
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Adding custom image sizes and post types to a plugin or to a theme?
- Show all tags on custom post type
- How to delete all trashed item in one-go
- Trying to get custom post of a custom taxonomy
- How to hook WP initialization without modifying functions.php
- Loop increase number
- ACF in wordpress
- Is This Code Efficient – Or is there a better way?
- Adding guestbook to my wordpress site
- Custom post type’s posts are not showing anywere but in xml sitemap
- Unable to format dates to put in event calendar
- Custom post type and custom taxonomy 404 on page 2
- Show current user posts in custom post type query
- Custom post type in Custom widget – $listItem
- Custom Plugin – Query CPT – Display Results
- CPT Repeatable Fields + Undefined Index
- foreach loop inside the loop creating duplicates in output
- Custom Post Type Causes Error: Warning: call_user_func_array()
- redirect after submiting post for review
- Plugin or ways to limit number of users logging in the website,
- Get only parent post in archive post
- update custom taxonomy custom fields
- Filter taxonomy by CPT
- Sort custom post column by generated value?
- Custom post type order by post_title
- Tell wordpress to show a single page instead of an archive page
- Get meta values from parent post and save in child post
- PHP Notice: Unidentified index
- Duplicate posts in my custom loop
- Populate metabox dropdown with post title from another Custom Post Type (issues with wp_reset / global $post)
- WordPress loop add heading before first of type
- Enable shortcodes on custom post type
- Best Plugins for Complex Index of Resources [closed]
- Meta box not saving
- Display subcategories in the filter on CPT
- Featured image in custom post is being disabled
- Plugin Error on activating
- Custom Search not working
- Custom Post Types in plugins?
- Plugins for putting Custom Post Types into the Menu
- Custom Post-type not returning the right child_of
- Plugin – read post into blank page [duplicate]
- WP_Query is getting the post but the_post() not rendering any Post
- Custom Post Type to Plugin
- Is there any way of not using my_init_method in the following code (that creates a custom post type)?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- Custom post type is_singular condtional not working when managing sidebar display
- Issue displaying multiple TinyMCE editors with WPAlchemy