Skip to content

Hack for working locally with APIs

Jason Conroy edited this page Jan 13, 2021 · 5 revisions
// Filter the WC API
add_filter( 'determine_current_user', function( $user_id ) {
	return 1;
}, 20 );
add_filter( 'woocommerce_api_check_authentication', function( $user ) {
	return new WP_User( 1 );
} );
add_filter( 'rest_authentication_errors', '__return_null', 500 );