This tutorial provides the steps to get rid of Monarch sharing plugin's sidebar of social icons in the Oxygen editor.



Step 1

Install and activate Code Snippets plugin.

Step 2

Go to Snippets > Add New.

Title: Remove Monarch from Oxygen editor


add_action( 'wp_enqueue_scripts', 'custom_monarch_oxy_editor', 20 );
 * Dequeues Monarch's assets and enqueues them everywhere except in Oxygen Builder.
function custom_monarch_oxy_editor() {
	wp_dequeue_style( 'et_monarch-css' );

	wp_dequeue_script( 'et_monarch-idle' );
	wp_dequeue_script( 'et_monarch-custom-js' );
	wp_dequeue_script( 'et-core-common' );

	if ( ! defined( 'SHOW_CT_BUILDER' ) ) {
		wp_enqueue_style( 'et_monarch-css', ET_MONARCH_PLUGIN_URI . '/css/style.css' );

		wp_enqueue_script( 'et_monarch-idle', ET_MONARCH_PLUGIN_URI . '/js/idle-timer.min.js', array( 'jquery' ), '', true );
		wp_enqueue_script( 'et_monarch-custom-js', ET_MONARCH_PLUGIN_URI . '/js/custom.js', array( 'jquery' ), '', true );
		wp_enqueue_script( 'et-core-common', ET_CORE_URL . 'admin/js/common.js', array( 'jquery' ), ET_CORE_VERSION, true );

add_action( 'wp_footer', 'custom_remove_monarch_html_oxy_builder' );
 * Remove Monarch's elements from the DOM in Oxygen editor.
function custom_remove_monarch_html_oxy_builder() {
	if ( defined( 'SHOW_CT_BUILDER' ) ) { ?>
			jQuery('.et_social_pin_images_outer, .et_social_sidebar_networks, .et_social_mobile_button, .et_social_mobile, .et_social_mobile_overlay, .et_social_totalcount').remove();
	<?php }

Set the snippet to run everywhere.

Save changes and activate.

That's it!

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?



For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: