How to use WordPress authentication on non-WordPress page?

Just add this at the top of your file: require_once($_SERVER[‘DOCUMENT_ROOT’].’/wp-blog-header.php’); // If you run multisite, you might nees this to prevent 404 error header(‘HTTP/1.1 200 OK’); Note that the file must be in the same folder as your theme. Then you can use is_user_logged_in before executing the rest of the script. If use is not … Read more

custom XMLRPC method plus authentication of user & WooCommerce order

I sent it to you on Twitter, but here it is again. I made this little class to help me do XML-RPC faster. abstract class MZAXMLRPC { protected $calls = Array(); protected $namespace = “myxmlrpc”; function __construct($namespace){ $this->namespace = $namespace; $reflector = new ReflectionClass($this); foreach ( $reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method){ if ($method->isUserDefined() && $method->getDeclaringClass()->name != get_class()){ … Read more

How to secure or disable the RSS feeds?

As pointed out in the comments by @kaiser, your question is very similar to this question. In fact, the question itself holds the answer. To disable all feeds add the following code… function itsme_disable_feed() { wp_die( __( ‘No feed available, please visit the <a href=”‘. esc_url( home_url( “https://wordpress.stackexchange.com/” ) ) .'”>homepage</a>!’ ) ); } add_action(‘do_feed’, … Read more

WordPress REST API – Permission Callbacks

The issue was because I wasn’t generating and sending a nonce value with the request. In order to generate a nonce value. Localize the value of a wp_create_nonce(‘wp_rest’) function call. wp_localize_script(‘application’, ‘api’, array( ‘root’ => esc_url_raw(rest_url()), ‘nonce’ => wp_create_nonce(‘wp_rest’) )); This will then be accessible to the window object of the browser which can be … Read more

How to check username/password without signing in the user

There is a function in the user.php of the core files called wp_authenticate_username_password that seems like what you’re looking for. If you want to avoid throwing in the $user object (you probably only have the username + password), then just throw null as 1st function argument in: $check = wp_authenticate_username_password( NULL, ‘some_username’, ‘#thepassw0rd’ ); You … Read more

File not found.