label ) || ! is_taxonomy_viewable( $taxObject ) || ! $this->taxonomyUpsellCanRender( $taxObject ) ) { unset( $taxonomies[ $taxObject->name ] ); } } foreach ( $taxonomies as $taxonomy ) { add_action( $taxonomy->name . '_edit_form', [ $this, 'addTaxonomyUpsell' ] ); add_action( 'after-' . $taxonomy->name . '-table', [ $this, 'addTaxonomyUpsell' ] ); } } } /** * Returns whether the taxonomy upsell can render for a taxonomy. * * NOTE: The upsell is the real metabox blurred behind the CTA, so the Vue app refuses to mount * where the metabox is switched off, leaving the CTA without the styles the app brings with it. * * @since 5.0.1 * * @param \WP_Taxonomy $taxObject The taxonomy object. * @return bool Whether the upsell can render. */ private function taxonomyUpsellCanRender( $taxObject ) { $taxonomy = aioseo()->helpers->isWooCommerceProductAttribute( $taxObject ) ? 'product_attributes' : $taxObject->name; // A taxonomy with no options of its own is absent from the localized dynamic options too, // so shouldShowMetaBox() can never resolve it. if ( ! aioseo()->dynamicOptions->noConflict()->searchAppearance->taxonomies->has( $taxonomy ) ) { return false; } // NOTE: Each read walks the full path — the options getter resets its group state after // returning a leaf. $showMetaBox = aioseo()->dynamicOptions->noConflict() ->searchAppearance->taxonomies->{$taxonomy}->advanced->showMetaBox; // NOTE: `advanced` stays unhydrated for the synthetic product_attributes group, so null // means "not configured" - the shipped default is on - and not "switched off". return null === $showMetaBox || (bool) $showMetaBox; } /** * Add Taxonomy Upsell. * * Renders the real post-settings metabox mount blurred out, with the floating CTA overlay on top. * The Vue app mounts on #aioseo-term-settings-metabox using the stub currentPost data populated * by {@see \AIOSEO\Plugin\Lite\Traits\Helpers\Vue::setTermData()}. * * @since 4.0.0 * @version 4.9.8 Replaced the stale static HTML mock with the real Vue post-settings metabox mount. * * @return void */ public function addTaxonomyUpsell() { $screen = aioseo()->helpers->getCurrentScreen(); if ( ! isset( $screen->parent_base ) || 'edit' !== $screen->parent_base || empty( $screen->taxonomy ) ) { return; } $utmUrl = aioseo()->helpers->utmUrl( AIOSEO_MARKETING_URL . 'lite-upgrade/', 'taxonomies-upsell', 'features=[]=taxonomies', false ); ?>