This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
BSF_Update_Manager::populate_no_update( object $_transient_data, string $product_type, array|null $all_products = null )
Add up to date products to the no_update list of the update transient data.
Description
Since WordPress 5.5, a plugin or theme absent from both the response and the no_update lists of its update transient is treated as not supporting updates, and the "Enable auto-updates" link/toggle is hidden on the Plugins/Themes screen. Populating no_update keeps it visible.
Handles both product types so the plugin and theme paths cannot drift.
Parameters
- $_transient_data
-
(object) (Required) Transient Data.
- $product_type
-
(string) (Required) Product type — 'plugins' or 'themes'.
- $all_products
-
(array|null) (Optional) Pre-fetched product list to reuse. Defaults to null (fetched internally).
Default value: null
Return
(object) $_transient_data
Source
File: admin/bsf-core/class-bsf-update-manager.php
private function populate_no_update( $_transient_data, $product_type, $all_products = null ) {
if ( null === $all_products ) {
$all_products = $this->get_all_products_for_type( $product_type );
}
$is_theme = ( 'themes' === $product_type );
foreach ( $all_products as $key => $product ) {
$product_id = isset( $product['id'] ) ? $product['id'] : '';
if ( bsf_product_updates_disabled( $product_id ) ) {
continue;
}
if ( false === $this->enable_auto_updates( $product_id ) ) {
continue;
}
$template = $this->get_product_template( $product );
if ( '' === $template ) {
continue;
}
// For themes, use wp_get_theme() so the check honours themes registered
// in additional roots via register_theme_directory() and confirms a real
// theme (style.css present), not just an existing directory.
if ( $is_theme && ! wp_get_theme( $template )->exists() ) {
continue;
}
// Skip products which have an update queued or are managed by another updater.
if ( isset( $_transient_data->response[ $template ] ) || isset( $_transient_data->no_update[ $template ] ) ) {
continue;
}
$version = bsf_get_current_version( $template, $product_type );
if ( empty( $version ) ) {
$version = isset( $product['version'] ) ? $product['version'] : '';
}
if ( $is_theme ) {
$entry = array();
$entry['theme'] = $template;
$entry['new_version'] = $version;
$entry['url'] = isset( $product['purchase_url'] ) ? $product['purchase_url'] : '';
$entry['package'] = '';
$entry['requires_php'] = isset( $product['php_version'] ) ? $product['php_version'] : '';
} else {
$entry = new stdClass();
$entry->id = $product_id;
$entry->slug = $this->bsf_get_plugin_slug( $template );
$entry->plugin = $template;
$entry->new_version = $version;
$entry->url = isset( $product['purchase_url'] ) ? $product['purchase_url'] : '';
$entry->package = '';
$entry->tested = isset( $product['tested'] ) ? $product['tested'] : '';
$entry->requires_php = isset( $product['php_version'] ) ? $product['php_version'] : '';
$entry->icons = apply_filters(
"bsf_product_icons_{$product_id}",
array(
'1x' => ( isset( $product['product_image'] ) ) ? $product['product_image'] : '',
'2x' => ( isset( $product['product_image'] ) ) ? $product['product_image'] : '',
'default' => ( isset( $product['product_image'] ) ) ? $product['product_image'] : '',
)
);
}
if ( ! isset( $_transient_data->no_update ) || ! is_array( $_transient_data->no_update ) ) {
$_transient_data->no_update = array();
}
$_transient_data->no_update[ $template ] = $entry;
}
return $_transient_data;
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.29.18 | Introduced. |