Support » Themes and Templates » How to use wp_get_theme?

  • Resolved keha


    I previously used get_theme_data to set some theme constants, but now it has been deprecated for some reason. How do I properly use get_theme_data?

    If I want to get the theme uri etc, I’ve tried like this:

    $dp_theme_data = wp_get_theme();
    define( 'DP_THEME_URI', $dp_theme_data[ 'URI' ] );

    Obviously it didn’t work, the constant is blank. How can I make it work, please?

Viewing 1 replies (of 1 total)
  • Figured it out, there’s possibly a better way of doing this?

    $dp_theme_data = wp_get_theme();
    define( 'DP_THEME_URI', $dp_theme_data->get('ThemeURI') );
Viewing 1 replies (of 1 total)
  • The topic ‘How to use wp_get_theme?’ is closed to new replies.