Find the URL of the current plugin directory
Try plugin_dir_url(): $new_avatar_url = plugin_dir_url( __FILE__ ) . ‘/avatar-1.jpg’;
Try plugin_dir_url(): $new_avatar_url = plugin_dir_url( __FILE__ ) . ‘/avatar-1.jpg’;
$_SERVER[‘REQUEST_URI’] is your only option. wordpress failed parsing the url so not much you can get from the API
Is there a way to determine if my current PHP file is within the plugins’ folder or within the themes’ folder Broadly you always have path to current file (__FILE__) so you can always examine it for where you are and compare with context. This might be good enough in custom site, but likely too … Read more
This isn’t a WordPress thing, this is a browser/HTTP thing. Firefox may be showing the / as part of a setting, but example.com and example.com/ are the same URL. This Q on webmasters goes into more detail as to why this is the case: https://webmasters.stackexchange.com/questions/35643/is-trailing-slash-automagically-added-on-click-of-home-page-url-in-browser
Try Yourls. I hadn’t used it myself but feedback I seen is very positive and it is project by very known developers (Lester Chan and Ozh).
The quickest way to do this is through an Apache rewrite via mod_rewrite. You’ll also have to tell WordPress where to points its login links using the login_url and logout_url filters. return apply_filters(‘login_url’, $login_url, $redirect); return apply_filters(‘logout_url’, $logout_url, $redirect);
Go to Settings->Permalinks, select Custom Structure, and set the text box to just /%postname%/ You might consider the second bullet point in the docs recommending against this particular URL pattern, though. This was addressed in 3.3
You can do this by adding this function to your funcitons.php file. function my_get_image_size_links() { /* If not viewing an image attachment page, return. */ if ( !wp_attachment_is_image( get_the_ID() ) ) return; /* Set up an empty array for the links. */ $links = array(); /* Get the intermediate image sizes and add the full … Read more
Download and install “Velvet Blues Update URLs”. Add your old url in the “Old URL” field, the new one in the “New URL” field, check all the checkboxes and click “Update URLs”. Update your permalinks afterwards
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