wp-json and what data does it give away?

/wp-json/ is the base part of the WordPress REST API https://developer.wordpress.org/rest-api/ An authors ID isn’t a big deal. I would imagine on your theme, every time the post authors name shows, within the HTML showing the name, there’d be element classes containing the authors ID. It’s normal to have shown in publicly viewable source code, … Read more

Rest API Multisite Site List?

There is no built-in endpoint for sites on a multisite network. As can be seen in the documentation, the built-in endpoints are: +—————-+——————-+ | Posts | /wp/v2/posts | +—————-+——————-+ | Post Revisions | /wp/v2/revisions | +—————-+——————-+ | Categories | /wp/v2/categories | +—————-+——————-+ | Tags | /wp/v2/tags | +—————-+——————-+ | Pages | /wp/v2/pages | +—————-+——————-+ | … Read more

WP REST API Post Status Using JavaScript

In this tutorial, the post var status=”draft”; (see code). So I am just worried that won’t anyone able to hack that status? It depends who it is. A logged out user cannot create any posts at all. A subscriber cannot either. A contributor could create the post, but not publish it. An author or editor … Read more

How to use current_user_can() in register_rest_route()?

You need to pass the wp_rest nonce with the JavaScript request that you send to REST. This nonce is what passes the information from PHP to JavaScript about which user is making the request. Example: <form> <input type=”text” name=”rest_auth_nonce” value=”<?= esc_attr( wp_create_nonce( ‘wp_rest’ ) ) ?>”> </form> <script> jQuery.ajax({ beforeSend: function (xhr) { xhr.setRequestHeader(‘X-WP-Nonce’, jQuery(‘form’).find(‘input[name=”rest_auth_nonce”]’).val()); … Read more

Why does AWStats show /wp-json* as Viewed URLs

I’m not entirely sure what will be better explanation, or why this one (the real one) is not enough. In your stats you see URLs of requests and not paths to files. URL has nothing to do with files on server. Yes – if the requests targets physical file, then that file exists, but… There … Read more

REST API GET users

Read the docs: you need to add a Header named X-WP-Nonce to your requests to the API that require authentication, as you can see in the jQuery example. However the catch is getting that nonce in the first place. WordPress inject that token itself in the post editing screens. Type wpApiSettings in the developer console … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)