qtranslate-xt icon indicating copy to clipboard operation
qtranslate-xt copied to clipboard

Not loading on backend when using custom path for `wp-admin`

Open Splact opened this issue 3 years ago • 4 comments

Since I've a custom path for wp-admin for security reasons, the check here is always failing when on admin pages. Seems like we are always doing_front_end, so qtx_admin.php is never loaded.

I fixed this changing the regex so that it matches my custom path, but would be nice to have here a wp filter so that we don't need to apply changes to the plugin codebase anymore.

Splact avatar Nov 15 '21 12:11 Splact

It reminds me of something, this part is handled pretty bad in WP. There should be a function to retrieve this, but there's only get_admin_url (URL, not path) and wp_admin is even hard-coded internally in WP... Do you get the correct path if run the admin_url filter?

herrvigg avatar Nov 16 '21 23:11 herrvigg

Yes I get the url with the right path, we could use this and rip off the protocol+domain part.

Splact avatar Nov 18 '21 20:11 Splact

Still it feels like a hack to use get_admin_url, it's not the same purpose and we should not assume about the http configuration. I would also like to avoid adding a new filter just for this. Let's see if we can find a better solution.

herrvigg avatar Nov 21 '21 17:11 herrvigg

The main problem is that WordPress doesn't handle this properly, it's hard-coded in WP, it's pretty bad :-/

herrvigg avatar Nov 21 '21 17:11 herrvigg