WC_Admin_Addons::get_sections()
Get sections for the addons screen
Метод класса: WC_Admin_Addons{}
Хуки из метода
Возвращает
Массив
. of objects
Использование
$result = WC_Admin_Addons::get_sections();
Код WC_Admin_Addons::get_sections() WC Admin Addons::get sections WC 9.4.2
public static function get_sections() { $locale = get_user_locale(); $addon_sections = self::get_locale_data_from_transient( 'wc_addons_sections', $locale ); if ( false === ( $addon_sections ) ) { $parameter_string = '?' . http_build_query( array( 'locale' => get_user_locale() ) ); $raw_sections = wp_safe_remote_get( 'https://woocommerce.com/wp-json/wccom-extensions/1.0/categories' . $parameter_string, array( 'user-agent' => 'WooCommerce/' . WC()->version . '; ' . get_bloginfo( 'url' ), ) ); if ( ! is_wp_error( $raw_sections ) ) { $addon_sections = json_decode( wp_remote_retrieve_body( $raw_sections ) ); if ( $addon_sections ) { self::set_locale_data_in_transient( 'wc_addons_sections', $addon_sections, $locale, WEEK_IN_SECONDS ); } } } return apply_filters( 'woocommerce_addons_sections', $addon_sections ); }