I solved my problem by trying this (and it works!):
function get_some_url() {
$full_url = add_query_arg( 'action', 'action-name', admin_url( 'users.php' ) );
//$relative_url = str_replace( get_site_url(), '', $full_url );
//return $relative_url;
return $full_url;
}
This was tested in a localhost/subdirectory install and in a live install (not subdirectory). Now the URL is retrieved correctly.
Related Posts:
- WordPress in sub directory wp-admin problem
- Unwanted redirect in admin area
- WordPress (behind HAProxy and Jetty), not multisite, in sub folder – and /en/wp-admin/ keeps redirecting to /wp-admin/
- Organizing Code in your WordPress Theme's functions.php File?
- How to check if a user is in a specific role?
- Can’t change language (only “English (United States)”)
- Create WP tutorial for users with admin pointer using next button for navigation
- Taxonomy dropdown metabox in the back-end
- How to redirect/rewrite all /wp-login requests
- Show all post tags on post edit screen/sidebox
- Disable image attachment links
- Remove “Time to upgrade” message from dashboard
- How can I enable Google Analytics on a file download link?
- What is the best method to close off the backend?
- Change Login URL Without Plugin
- Pre-fill fields with content from outside when creating a new post
- Why are admin scripts not printed
- White screen of death only in wp-admin
- Change the link of ‘Howdy’ at the top right
- wp-admin remove the subfolder URL
- Reorder custom submenu item
- Options for restricting access to wp-admin
- Looking for a hook to add attachment information to the media library tab
- Removing admin bar from wordpress dashboard
- Load Balanced WP with single server admin access
- WP-admin giving 404
- How to control contextual help section by code?
- Can’t access wp-admin Internal Server Error 500
- File exceeds upload_max_filesize, despite max filesize being large enough
- WordPress admin not changing language
- Add custom text to Page Tamplate without need to know html
- Move WP Admin Bar
- Get Stylesheet To Showup in WP Admin Panel Editor
- Deprecated : contextual_help has been deprecated since version 3.3.0
- Just how ‘expensive’ is this function?
- Custom Background-Image not showing up
- js Conflict in admin panel – I guess it’s from the core WP installation
- Why is there an intermediate redirect to https://public-url.org/wp-admin?
- Remove query var on admin pages when ‘Save changes’ pressed
- How to hide wordpress default description box?
- Create a fullwidth dashboard widget
- admin_url in plugins
- Website looks fine, but login to wp-admin yields a blank screen
- cannot find the login page for local WordPress site
- In editor-style.css how can I change background color of title field?
- /wp-admin/ 500 error
- Where did the screen options menu go?
- How do I change the upload file size limit in single-site wordpress install?
- Can’t call external stylesheet for WordPress admin (using wp_admin_css)?
- wrapping ‘rest_api_init’ in ‘is_admin()’ function
- display dynamic WP Site logo on wp-admin using CSS
- WordPress notification reports
- Restore a layout [closed]
- Logging into sandbox subdomain WP
- White screen of death on admin and other dashboard pages
- TinyMCE strips breaks inside editor
- can not access wp-admin after migrating to openshift
- wp-admin url doesn’t allow to login and redirects to same page
- wp-admin dashboard redirects to homepage
- Can I hook into wp_update_core outside of the admin?
- /wp-admin/ doesn’t work but /admin/ does
- WordPress Side Menu Admin Panel Default Order numbers List?
- Why can I log into wp-login.php and not wp-admin.php?
- Change admin defaults for reading settings
- How to hide Admin Tabs? [duplicate]
- wp cron, admin and updates questions
- Restrict admin access to certain pages based on page slug
- Unable to properly login
- Is there a simple way to set wordpress site files back to out of the box?
- Remove header text option from the backend
- User Capabilities are not available in WP REST permission callback?
- How to check if it’s edit.php & post_type is set?
- Dashboard : remove Safari navigator message
- Available resources for learning WordPress 4.7.2 from the ground up?
- Contextual help in wp-admin for non admins
- Trying to create a page as a menu item in the admin while keeping the admen panel visible
- Weird urls after moving site from local env to a server
- Manage Admin permissions by URL GET parameters
- Set edit capability based on ACF relationship
- How to access wp-admin from original website after setting the domain redirect/forwarding
- Step by step guide for new users on how to post content?
- How can I fix, Sorry, you are not allowed to access this page. I have tried the usual
- Hook into form handle from admin users table
- Display Form in Admin Panel and Save data to Database
- Cannot log in to WordPress admin or change password
- 403 Error when using save buttons
- wp-login.php entering password nothing happens
- Js errors in wp-admin
- Avoid executing a function (redirect) if I’m in the admin area
- Wp-admin loguts me. When sign with Wp_singon
- Localhost install: Administrator lost administrator access; cannot access Dashboard
- How to keep the plugin submenu open on viewing a custom version of users.php?
- Admin Panel issue
- I cannot access my WP website after changing settings
- Blank sign in page
- Action for opening edit page in admin?
- What is the point of new confirm admin email process?
- ‘Too many redirects’ error after changing site URL in WordPress [closed]
- Couple questions about .htaccess, login page, updates
- WordPress Localhost migration issue