Fetch only categorized posts

category__not_in is a private query var. This means you can only use it when constructing a query in PHP, not in a url. You would have to construct your own custom public query var and bind that to a filter that reads the category and then changes the query accordingly.

WordPress Customazation API section in section

That is a Panel, the customizer contains three layers: panels contain sections, sections contain settings, and settings are the data that gets managed by the controls in the customizer UI. [panel] |–[section] | |–[setting] and his [control] | |–[setting] and his [control] |–[section] | |–[setting] and his [control] | |–[setting] and his [control] Panel, Section, … Read more

How to get custom or filtered endpoints in WordPress API?

Here is an example of how to use Javascript to read posts from the WordPress API. //Pegasus = Theme name $.getJSON(‘https://visionquestdevelopment.com/wp-json/wp/v2/posts’, function(data){ //foreach post for (i = 0; i < data.length; i++) { //console.log(data[i]); var output=””; var dateT; var dateArr = []; //skip one of the posts with 404s on images if( ‘1555’== data[i].id ) … Read more

Should I edit a user meta field with PUT, PATCH, or POST and WP::Editable

Okay, with some great examples from : https://restfulapi.net/resource-naming/ and http://www.restapitutorial.com/lessons/restfulresourcenaming.html I’m going to answer my own question. ESSENTIALLY, for my use case, I will NOT use PUT but rely on POST and DELETE to collection and singleton endpoints. Notes: I’ve omitted the wp-json/my-site-namespace/v1 prepending examples for clarity I’ve used query strings in POST requests but … Read more

Hiding WordPress REST endpoints from public viewing using Basic Authentication

Here is my solution. Inside the callback function I validate Authorization from the header like this: function callback_function($data) { //Get HTTP request headers $auth = apache_request_headers(); //Get only Authorization header $valid = $auth[‘Authorization’]; // Validate if ($valid == ‘Basic Base64UsernamePassword’) { //Do what the function should do } else { $response=”Please use a valid authentication”; … Read more