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

Permit running requests as frontend vs. backend #18

Open
danielbachhuber opened this issue Aug 25, 2016 · 7 comments
Open

Permit running requests as frontend vs. backend #18

danielbachhuber opened this issue Aug 25, 2016 · 7 comments

Comments

@danielbachhuber
Copy link
Member

danielbachhuber commented Aug 25, 2016

We should only load the request as backend when the user explicitly designates such:

wp profile stage --url=domain.com/wp-admin/
@alessandro-fazzi
Copy link

alessandro-fazzi commented Sep 6, 2017

A question about this one: is somehow possible atm to execute a profiling against /wp-admin/* urls?

@schlessera
Copy link
Member

@pioneerskies I just tried, as I thought it would be a simple matter of adding an authorized --user=<user> to the request, but It seems to always fail because of a redirect. I'll have to investigate this in more detail, but at first glance, the profiling seems to work on the frontend only right now.

@alessandro-fazzi
Copy link

Thanks @schlessera for the kind reply; this confirms my evidence :)

@mrdonthave
Copy link

Are they any news related to?
Is it now possible to profile /wp-admin too?

@Kilbourne
Copy link

The problem lays in load_wordpress_with_template method of profiler class ( called by run() ), which loads template-loader.php, and so triggering wp_redirect_admin_locations() attached to template_redirect filter.

This could also be a step towards profiling ajax request #4

@torarnv
Copy link

torarnv commented Nov 6, 2018

Any way to work around this? I really need to profile an admin page. Are there other ways to profile these in a simple way that doesnt involve xdebug or similar?

@nhadsall
Copy link

nhadsall commented Sep 10, 2021

So, I realize this is several years old, but HUGE thanks to @Kilbourne who provided the clues needed to solve this. I simply removed that hook and we're golden! I hope this helps out anyone else.

if ( defined( 'WP_CLI' ) && WP_CLI ) {
	add_action('init', function() {
		remove_action('template_redirect', 'wp_redirect_admin_locations', 1000);
	});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants