Quantcast
Channel: admin — WordPress Plugins
Viewing all articles
Browse latest Browse all 2035

Process Automation (WooCommerce Support)

$
0
0

Emailed Author: ## Calling file locations poorly

The way your plugin is referencing other files is not going to work with all setups of WordPress.

<img src="<?php echo admin_url() ?>../wp-content/plugins/process-automation-automation/media/img/ajax-loader.gif" />

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

When you hardcode in paths, or assume that everyone has WordPress in the root of their domain, you cause anyone using 'Giving WordPress it's own directory' (a VERY common setup) to break. In addition, WordPress allows users to change the name of wp-content, so you would break anyone who choses to do so.

Please review http://codex.wordpress.org/Determining_Plugin_and_Content_Directories and update your plugin accordingly. And don't worry about supporting WordPress 2.x or lower. We don't encourage it nor expect you to do so, so save yourself some time and energy.

## Including jquery files (or calling them remotely)

WordPress includes its own version of jquery and many other similar JS files, which have all been rigorously tested with WP and many of the most common plugins. In order to provide the best compatibility and experience for our users, we ask that you not package your own (especially not an older version) and instead use wp_enqueue_script() to pull in WordPress's version.

Please review http://codex.wordpress.org/Function_Reference/wp_enqueue_script and update your plugin accordingly. You need to both change your code to use our jquery as well as remove the unused files. Remember! Keeping unused files out of your plugins makes them smaller and less potentially vulnerable! if you have any jquery files included in your plugin that WP core has, just delete them.

Offloading jquery js, css, and other scripts to Google (or jquery.com or anywhere else frankly) is similarly disallowed for the same reasons, but also because you're introducing an unnecessary dependency on another site. If the file you're trying to use isn't a part of WordPress Core, then you should include it -locally- in your plugin, not remotely.

If your code doesn't work with the built-in versions of jquery, it's most likely a no conflict issue. If you can't guess, we -really- want you to use our JS files, and if you can't, we need to know why so we can fix things for everyone. If you're just including it because you want to support old versions of WP, or because you think they may not have jquery, please don't. If they don't have the default jquery, a lot more than your plugin will break. And if they're on older versions of WordPress, they need to upgrade, and we don't recommend you support anything except the most recent version of WP and one release back.

When you've corrected your code, reply to this email with the updated code attached as a zip, or provide a link to the new code for us to review.


Viewing all articles
Browse latest Browse all 2035

Trending Articles