I would like to have my plugin detect the current "activated" theme. If my starter theme or the correct child theme is not loaded, then alert the administrator from wp-admin with an alert notification.
I can figure out the latter, but it's the former I have a question about...are their hooks or conditional tags already built into WordPress that allows me to do this easily, or do most professional wp coders have their own custom logic of doing this?
I'm ultimately building a plugin to assist & extend a specific starter theme.
I want the plugin to detect this for the existing theme, and if a theme in the future is activated.
Many thanks for the education!
I would like to have my plugin detect the current "activated" theme. If my starter theme or the correct child theme is not loaded, then alert the administrator from wp-admin with an alert notification.
I can figure out the latter, but it's the former I have a question about...are their hooks or conditional tags already built into WordPress that allows me to do this easily, or do most professional wp coders have their own custom logic of doing this?
I'm ultimately building a plugin to assist & extend a specific starter theme.
I want the plugin to detect this for the existing theme, and if a theme in the future is activated.
Many thanks for the education!
Share Improve this question edited Feb 10, 2019 at 22:06 klewis asked Feb 10, 2019 at 21:58 klewisklewis 8991 gold badge14 silver badges32 bronze badges1 Answer
Reset to default 3You can use wp_get_theme
to get current theme object.
$current_theme = wp_get_theme();
And it will return WP_Theme object.