Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getWPAdminURL assumes you are in wp-admin #7095

Closed
mkaz opened this issue Jun 1, 2018 · 4 comments
Closed

getWPAdminURL assumes you are in wp-admin #7095

mkaz opened this issue Jun 1, 2018 · 4 comments
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended

Comments

@mkaz
Copy link
Member

mkaz commented Jun 1, 2018

The true bug is when using Gutenberg out of the /wp-admin/ , for example as a front-end editor within P2 theme and the user selects "Move to Trash" the TRASH_POST_SUCCESS effect redirects the browser location to"

window.location.href = getWPAdminURL( 'edit.php', { ... } )

However, getWPAdminURL() does not actually get the /wp-admin/ URL, it only adds query parameters to the page passed in, which works if the editor is already in /wp-admin/ but not if it elsewhere.

To Reproduce
Steps to reproduce the behavior:

See getWPAdminURL function in editor/utils/url.js does not return the URL of a wp-admin page

Expected behavior

The function should return a full relative link to /wp-admin/

@danielbachhuber danielbachhuber added [Type] Bug An existing feature does not function as intended REST API Interaction Related to REST API labels Jun 4, 2018
@gziolo gziolo added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Jun 11, 2018
@mcsf
Copy link
Contributor

mcsf commented Jul 5, 2018

@danielbachhuber: I'm not necessarily objecting, but wanting to understand: why the Back Compat label? Seems like this only affects use cases where we'd want to use Gutenberg outside of WP-Admin, and I'd interpret anything non-WP-Admin to fall outside of the domain of backward compatibility. No?

Full disclaimer: my gut says this is not needed for 5.0 and we should close it for now.

@danielbachhuber
Copy link
Member

@mcsf admin_url() is filterable. I think #7096 would be sufficient though.

@danielbachhuber
Copy link
Member

I think #7096 would be sufficient though.

Alternatively, we can close this issue until it comes up again. I consider it relatively minor.

@mcsf
Copy link
Contributor

mcsf commented Jul 10, 2018

Alternatively, we can close this issue until it comes up again. I consider it relatively minor.

Cool, I agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants