: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* The class is responsible for configuring the TinyMCE editor to allow unsafe link targets.
* @author Advanced Ads <info@wpadvancedads.com>
namespace AdvancedAds\Admin;
use AdvancedAds\Framework\Interfaces\Integration_Interface;
defined( 'ABSPATH' ) || exit;
class TinyMCE implements Integration_Interface {
public function hooks(): void {
add_filter( 'tiny_mce_before_init', [ $this, 'allow_unsafe_link_target' ] );
* Configure TinyMCE to allow unsafe link target.
* @param bool $mce_init the tinyMce initialization array.
public function allow_unsafe_link_target( $mce_init ) {
if ( ! function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen();
if ( 'advanced_ads' === ( $screen->id ?? '' ) ) {
$mce_init['allow_unsafe_link_target'] = true;