: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
public function append_javascript_data( &$data ) {
$pub_id = Advanced_Ads_AdSense_Data::get_instance()->get_adsense_id();
$data['pubId'] = $pub_id;
$data['connected'] = $this->is_account_connected();
'matched_content' => _x( 'Multiplex', 'AdSense ad type', 'advanced-ads' ),
'in_article' => _x( 'In-article', 'AdSense ad type', 'advanced-ads' ),
'in_feed' => _x( 'In-feed', 'AdSense ad type', 'advanced-ads' ),
'display' => _x( 'Display', 'AdSense ad type', 'advanced-ads' ),
'link' => _x( 'Link', 'AdSense ad type', 'advanced-ads' ),
* If the ad also has a manual ad setup option.
public function supports_manual_ad_setup() {
* Get the ad unit associated with a given ad ID.
* @param int $ad_id The ID of the ad.
* @return object|null The ad unit object associated with the given ad ID, or null if not found.
function get_ad_unit( $ad_id ){
$ad_repository = new \Advanced_Ads\Ad_Repository();
$adense_ad = $ad_repository->get( $ad_id );
if ( ! $adense_ad || 'adsense' !== ( $adense_ad->type ?? '' ) || ! isset( $adense_ad->content ) ) {
$ad_units = $this->get_external_ad_units();
if ( empty( $ad_units ) ) {
$json_content = json_decode( $adense_ad->content );
$unit_code = $json_content->slotId ?? null;
foreach( $ad_units as $ad_unit ) {
if( $ad_unit->slot_id === $unit_code){