1

I have created a WordPress plugin but it's conflicting with the WordPress jquery.

function maintenance_scripts() {
    wp_register_style('style', plugins_url('scripts/jquery-ui.css',__FILE__ ));
    wp_enqueue_style('style');

    wp_register_script( 'jquery-1.10.2', plugins_url('scripts/jquery-1.10.2.js',__FILE__ ));
    wp_enqueue_script('jquery-1.10.2');

    wp_register_script( 'jquery-ui', plugins_url('scripts/jquery-ui.js',__FILE__ ));
    wp_enqueue_script('jquery-ui');

    wp_register_script( 'jquery-settings', plugins_url('scripts/jquery-settings.js',__FILE__ ));
    wp_enqueue_script('jquery-settings');
}
add_action( 'admin_init','maintenance_scripts');

I have tried to remove my own jQuery and let it run on the WordPress jQuery but that did not work. I have also tried to deregister the WordPress jquery but without any luck.

Any experts out there know the solution?

1 Answer 1

1

I have fixed it by placing all the scripts inside the jquery-settings.js inside the footer of the admin area like so:

function maintenance_fjquery() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
    ...
});
</script>
<?php
}
add_action( 'in_admin_footer', 'maintenance_fjquery' );

... and remove the jquery-1.10.2.js and jquery-ui.js.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.