URL parsing – what is it?

Parsing means to analyze (a string or text) into logical syntactic components. Taking WordPress URLs into the question is something like this: // Get array of URL ‘scheme’, ‘host’, and ‘path’. $url_parse = wp_parse_url( ‘https://developer.wordpress.org/reference/functions/wp_parse_url/’ ); // Output URL’s path. echo $url_parse[‘path’]; /* Array ( [scheme] => https [host] => developer.wordpress.org [path] => /reference/functions/wp_parse_url/ ) … Read more

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

tech