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?
- Allow Users Access to Custom Post Type Only
- How do you output custom code between posts in the loop?
- Show ACF field from custom taxonomy and display on the single template
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- Change message given when deleting post from custom post type
- Display children and grandchildren of a custom post type
- Best practice for adding posts in bulk
- wordpress custom post type remove duplicate menu item
- Using WPAlchemy metabox values in another metabox
- Is it a good practice to include custom options when registering a post type?
- is_page_template not working as expected
- List terms from Custom Taxonomy
- Hide Meta Boxes for Non-Admins
- Making a Custom Post type only visible to non-users via a specific link
- Custom post type capabilities require “create_posts” to access the edit posts list page
- How to get images from EDD post?
- WP_Query search posts by custom post type and custom taxonomy
- Limit users by custom taxonomy and user roles
- Adding Meta Boxes while Registering a Post Type in a Class
- Issue to get wp_get_attachment_image with cmb2
- How to have the right design for a custom post type without accessing themes
- Dynamic Custom Post Type Plugin
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- I am having a problem with form updating/editing WordPress post on the frontend
- How to filter out post type meta?
- Best action hook to create custom post and assign taxonomy terms to it on plugin activation?
- How to make in WordPress admin panel sortable column for the custom field, that count the number of page impressions?
- Display custom field of specific post where post title matches variable
- Conditional to modify query results
- Creating a custom post type using a object oriented approach?
- Loop through posts of a custom-post-type (event) and create .ics (iCal) file?
- Custom Post Type | Fatal Error on register_post_type()
- Output custom post shortcode. Help spot the error.
- How to count custom post types with conditional operators
- Set object terms not working on plugin activation
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- Return array of categories to php function for current post
- Link users to a custom post type
- Create a random unique 6 digit number as custom field for custom post type
- How to output wordpress custom tags separated by comma?
- how to add extra meta box or textarea into custom post types
- Loading all files within a directory
- Blog page showing same content as homepage
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Using several custom fields as custom post title
- Custom Post Type without an archive page
- Get rewrite slug of custom post type in template
- Show Different Header on a Specific Post ID
- “add_post_type_support” with Custom Post Type & ACF
- Get Post Primary Category
- Weird problem happening with custom taxonmy when creating/updating posts
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- Shortcode insertion in tab
- Admin notice not displaying
- How to quickly reorder posts in the admin panel that will persist for the wp-api
- Create custom post type on successful woocommerce order [closed]
- Add CPT as subpage under custom page
- Adding custom tables to WordPress
- WooCommerce product search titles only
- check if post title in a custom post type exists in page
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Very Slow Page – How to Optimize # of Queries?
- Dynamic page outside WordPress
- How to hack YARPP plugin to find related posts for custom post type?
- Using wordpress template tags within an array
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Getting the URL of the parent page
- Custom query to filter posts that have current post as a taxonomy [closed]
- Custom post type permalink returns bad url
- Return the thumbnail meta data for getter and setter
- Accessing post’s meta data based on user’s click of a post
- How to display selected taxonomies by their parent
- Show listings from Impress Listing plugin in random order using taxonomy and terms