'wp_insert_gutenberg' ] ); } } add_action( 'admin_footer-post-new.php', 'wp_insert_gutenberg_admin_footer' ); add_action( 'admin_footer-post.php', 'wp_insert_gutenberg_admin_footer' ); function wp_insert_gutenberg_admin_footer() { echo ''; echo ''; } add_action( 'wp_ajax_wp_insert_gutenberg_get_ad_data', 'wp_insert_gutenberg_get_ad_data' ); function wp_insert_gutenberg_get_ad_data() { check_ajax_referer( 'wp-insert-gutenberg', 'wp_insert_gutenberg_nonce' ); $adData = []; $inpostads = get_option( 'wp_insert_inpostads' ); if ( isset( $inpostads ) && is_array( $inpostads ) ) { foreach ( $inpostads as $key => $inpostad ) { /* Begin Workaround for migrating old users to new system (can be removed in a later version) */ $title = $key; if ( ! isset( $inpostad['title'] ) || ( $inpostad['title'] == '' ) ) { switch ( $key ) { case 'above': $title = 'Above Post Content'; break; case 'middle': $title = 'Middle of Post Content'; break; case 'below': $title = 'Below Post Content'; break; case 'left': $title = 'To the Left of Post Content'; break; case 'right': $title = 'To the Right of Post Content'; break; } } else { $title = $inpostad['title']; } /* End Workaround for migrating old users to new system (can be removed in a later version) */ $adData[] = [ 'type' => 'inpostads', 'id' => $key, 'title' => 'In-Post Ad : ' . $title, ]; } } $shortcodeads = get_option( 'wp_insert_shortcodeads' ); if ( isset( $shortcodeads ) && is_array( $shortcodeads ) ) { foreach ( $shortcodeads as $key => $shortcodead ) { $title = $key; if ( isset( $shortcodead['title'] ) && ( $shortcodead['title'] != '' ) ) { $title = $shortcodead['title']; } $adData[] = [ 'type' => 'shortcodeads', 'id' => $key, 'title' => 'Shortcode Ad : ' . $title, ]; } } echo '###SUCCESS###'; echo wp_json_encode( $adData ); wp_die(); }