Reputation: 1818
Please Help:
I am getting this Custom Post type Object within Wordpress. This is actually what print_r($this) returns.
How can I get the content of 'key', for example?
Post_Types Object (
[post_types_definition:Post_Types:private] => Array (
[0] => Array (
[key] => solutions
[name] => Solutions
[taxonomies] => Array ( )
[categories] =>
[show_in_nav_menus] =>
[settings] => Array (
[0] => Array (
[title] => Solutions settings field
[description] => Solutions settings field
[type] => text
[properties] => Array (
[text-id] => solutions_settings_field_2
)
)
)
)
)
)
Any help is highly appreciated it!
Upvotes: 0
Views: 247
Reputation: 193
Run get_object_vars()
on your $this
to get the variables available to you. From there, you should be able to access the variable by its name through your instance like so:
$this->my_variable
Unless this is a dynamically-created variable, you should be able to simply look at the code, especially considering this is such a simple object. However, if you are ever in a pickle, I find this particularly helpful.
Upvotes: 1