Authenticate current user to REST API

I solved my problem. This got me on the right track: https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/ You can just make an api call via frontend and jquery. $.ajax( { url: ‘<?php echo esc_url_raw( rest_url()) ?>’ + ‘your/endpoint’, method: ‘GET’, beforeSend: function ( xhr ) { xhr.setRequestHeader( ‘X-WP-Nonce’, ‘<?php echo wp_create_nonce( ‘wp_rest’)?>’ ); } } ).done( function ( response ) … Read more

Allow users to create post without logging in?

the easiest way is to use this plugin: http://wordpress.org/plugins/guest-posts/ Offer your blog guests or unregistered blog readers an opportunity to post on your WordPress blog without registering themselves. Guest Posts will help you to create a strong interaction and engagement with your blog readers. This plugin will create a form where your guests can submit … Read more

How to set a cookie for logged in users to md5($user->ID . “my_secret”)?

Nevermind, I’ve figured it out: function init() { $user = wp_get_current_user(); if (!$user instanceof WP_User) return; $year = time() + 60 * 60 * 24 * 30 * 12; $auth = md5(join(‘_’, array($user->ID, “my secret”))); setcookie(‘visitor_id’, $user->ID, $year, “https://wordpress.stackexchange.com/”); setcookie(‘visitor_auth’, $auth, $year, “https://wordpress.stackexchange.com/”); } add_action(‘init’, ‘init’);

Rest API basic auth not working

The REST API does not support basic authentication out of the box, you need a plugin. The documentation points to this one, accompanied by this warning: Note that this plugin requires sending your username and password with every request, and should only be used for development and testing i.e. not in a production environment.