- Profile command
- wp doctor command
- Changing slug of CPT, from theme

Profile command
Install using
wp package install wp-cli/profile-command:@stable
Or for latest dev version use this
wp package install wp-cli/profile-command:dev-master
wp profile stage
- We can use this command to get the loading time of each stage of wordpress load

We can use this to see where the site is taking time to load
We can the drill down into specific stage using wp profile stage <stage>
wp profile stage main_query
This will give the data hook wise which then we can use to again drill down to specific hook
wp profile hook <hook name>
It will show which function is hooked into it, in which file and on which line
It is a very useful command when figuring out why exactly the site is loading slow.
wp doctor command
The wp doctor command runs some checks on our site from that we can diagnose our site
To install wp doctor use
wp package install wp-cli/doctor-command:@stable
or for dev version
wp package install wp-cli/doctor-command:dev-master
Below is the list of checks it runs
- autoload-options-size : Warns when autoloaded options size exceeds threshold of 900 kb.
- core-update : Errors when new WordPress minor release is available; warns for major release.
- plugin-active-count : Warns when there are greater than 80 plugins activated.
These are just few, we can get the whole list using command wp doctor list
Changing slug of CPT, from theme 
Why would we ever want to do this? , well in my case I forgot to remove the rewrite argument in CPT registration, which changes the default slug from something that I do not want.
Why not change the CPT code itself?, the CPT code is in the remote envrionment and I am working on the theme branch makes no sense to change the code inside plugin to hotfix this issue
Below is the code I tested if works
function change_person_slug( $args, $post_type ) {
/*item post type slug*/
if ( 'rt-person' === $post_type ) {
$args['rewrite']['slug'] = 'rt-person';
}
return $args;
}
add_filter( 'register_post_type_args', 'change_person_slug', 10, 2 );
We have to refresh the permalinks by going to admin and clicking save on permalinks. As it will need to get refreshed.








































