plugins_url() incorrectly returns a url with www subdomain

You can try to override it by using the following in config.php and see if it works as it will update your database, doing so will make it unable to be changed in your admin (it will be greyed out). define(‘WP_SITEURL’, ‘http://example.com/’); And some alternative definitions, http://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29 If that doesn’t work, I would check your … Read more

Dropzone.js and wordpress plugin

I assume the issue is that your form targets an external file, where WordPress isn’t properly loaded to access the API. WordPress has a handler built in that you can use to process POST requests, via the admin_post action: Example form with hidden action field: <form action=”<?php echo admin_url( ‘admin-post.php’ ); ?>” method=”post”> <input type=”hidden” … Read more

URL rewriting for WordPress Network (Multisite) subsite

This is straightforward if I understand the question properly. Use the “WordPress MU Domain Mapping” plugin: http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/ Update I think something like the following should work in your .htaccess: RewriteCond %{HTTP_HOST} www.exampleurl.com RewriteCond %{REQUEST_URI} !^/testsite RewriteRule ^(.*)$ testsite/$1 [L] This will return the contents of the folder “testsite” for “www.exampleurl.com”. And if you have: www.exampleurl.com/myoldsite/ … Read more

plugins_url(”,__FILE__) != WP_PLUGIN_URL with sym links

When writing a plugin, I define a few constants including the path to the plugin’s root folder, and its “name” as used in some admin hooks: define(‘WPSE_102681_PLUGIN_NAME’, basename(dirname(__FILE__)) . “https://wordpress.stackexchange.com/” . basename(__FILE__)); I’ve found that plugins_url() happily takes that constant, which is useful when referencing files from subfolders of the plugin, like so: echo plugins_url(‘images/information.png’, … Read more

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

Filter category_link so WordPress creates slashed URLs for categories, and redirect_canonical so it accepts those URLs: add_filter( ‘category_link’, ‘wpse_71666_trailingslash_cat_url’ ); add_filter( ‘redirect_canonical’, ‘wpse_71666_trailingslash_cat_url’, 20, 2 ); function wpse_71666_trailingslash_cat_url( $url, $request=”” ) { if ( ‘category_link’ === current_filter() ) return rtrim( $url, “https://wordpress.stackexchange.com/” ) . “https://wordpress.stackexchange.com/”; if ( “$url/” === $request and is_category() ) return $request; … Read more

Posts URL structure like site.com/category/the-post-title

Yes, any of those are possible and configurable under Settings > Permalinks. Have a look at the Permalinks page for other possibilities. One thing to note though, it’s suggested to add a number at the beginning of your permalinks to reduce the number of rewrite rules WordPress has to generate to resolve all of your … Read more

How to call images from your plugins image folder?

Use plugin_dir_url() to get the public URI for the directory where the calling PHP file is. <img src=”https://wordpress.stackexchange.com/questions/60230/<?php echo plugin_dir_url( __FILE__ ) .”images/facebook.png’; ?>”> If the PHP file is in a sub directory of your plugin you have to go up: <img src=”https://wordpress.stackexchange.com/questions/60230/<?php echo plugin_dir_url( dirname( __FILE__ ) ) .”images/facebook.png’; ?>”>