[resolved] How to use wp_get_theme? (2 posts)

  1. keha76
    Posted 3 years ago #

    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?

  2. keha76
    Posted 3 years ago #

    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') );

Topic Closed

This topic has been closed to new replies.

About this Topic