Articles of plugins url

Are there functions for file paths, instead of just urls

Is there any equivalent to functions like plugins_url() and content_url() that give you either the relative paths or the file path. For instance, instead of http://localhost:8888/wordpress-3.2/wp-content I want: /Users/username/Sites/wordpress-3.2/wp-content I know that I can build this path using the ABSPATH constant, but I’m specifically interested in learning if there are built in functions to handle […]

plugins_url() works everywhere but wp_reqister_script()

So I should probably mention up front that I’m developing a plugin so my url is ‘mysite.com/plugin’ (Just in case this is related to my issue. So, In my main plugin file (myplugin.php) I have added the following: $plugin_url = plugins_url(‘/my-plugin-directory/’); immediately followed by wp_enqueue_style(‘wp_enqueue_scripts’, $plugin_url . ‘css/boxes.css’); Great, so far so good. The plugin […]

Components used in Themes and Plugins: How to get file URL?

In my projects I have some components which I use in a lot of custom Plugins as well as in some custom coded Themes like e.g. admin image or video selectors. Those I am holding in custom git repositories. However as those components are used in both – themes and plugins – I always have […]

plugins_url() incorrectly returns a url with www subdomain

I’m working on a plugin which we’ll call “my-plugin” for the purposes of this question. The my-plugin directory looks like this: my-plugin/ |- image.jpg |- script.js |- script.php |- plugin.php |- ajax.php In script.php I have a section of code that specifies some JS. In it, I need a URL for ajax.php. e.g.: <script type=”text/javascript”> […]

Dropzone.js and wordpress plugin

I’m currently using Dropzone.js within a personal plugin and I’m able to create the dropzone, however when I pass in plugins_url as the action I’d like to get the files and add them to the wordpress media using the usual insert_attachment function found on the wordpress documentation. Dropzone: <form id=”udev-dropzone” method = “post” action=”<?php echo […]

plugin_dir_url() adds path to url

For some reason I get the following output from var_dump( plugin_dir_url( __FILE__ ) ); http://local.dev/wp-content/plugins/C:/development/xampp/htdocs/vanilla/wp-content/themes/twentyeleven/ in a local install. Note: I deactivated all plugins and added the line on top of the functions.php file of the default and unmodified TwentyEleven Theme

How to call images from your plugins image folder?

I’ve done a lot of research and learned a lot about WP constants and function usage for getting image paths etc. but still my original problem persists. <img src=”<?PHP echo WP_PLUGIN_DIR . ‘vertical-social-buttons/images/facebook.png’?>”> <img src=”<?PHP echo WP_PLUGIN_DIR . ‘vertical-social-buttons/images/facebook.png’?>”> <img src=”<?PHP echo plugins_url(‘vertical-social-buttons/images/facebook.png’, __FILE__);?>”> All give me broken images. Am I missing something obvious?

Add forward slash on categories url (serve one version of a url)

How can I a add forward slash on categories URLs and serve only that version of a category (meaning URLs not ending in forward-slash will redirect to URLs ending in forward slash). I manage to remove the category base using the “WP No Category Base” plugin but I need to add a forward slash on […]

Is it safe to pass directory path to plugins_url()?

plugins_url() function accepts plugin slug or file path to build URL for. I have following directory structure: /wp-content/mu-plugins/someplugin/css/file.css /wp-content/mu-plugins/someplugin/includes/file.php I need to build URL to file.css in file.php. I can’t pass __FILE__ because that will be one level too deep. plugins_url(‘css/file.css’, __FILE__ ) I can pass __DIR__ to get correct level and it seems to […]

Security in WordPress plugin development

My plugin is Mailer.app for WordPress, I’m 85% completed and I’m focusing on security before release. Before the questions, I should outline the plugins architecture: The plugin is able to take in username & password and relative imap/smtp server details. The details are validated and made sure that correct imap/smtp are entered (valid connection(s) made) […]