Create a post with REST API and adding a category

Solution was simple. Set DOM element value in JS variable instead of “document.getElementById(‘post_category’).value” in array. var submitBtn = document.getElementById(‘submit-post-btn’); submitBtn.addEventListener(‘click’, function(){ var categoryTerm = document.getElementById(‘post_category’).value; var postData = { “title”: document.getElementById(‘post_title’).value, “content”: document.getElementById(‘post_content’).value, “status”: ‘publish’, “categories”: [categoryTerm] } };

use WordPress Rest API to build a web application

In general, if you want totally headless application, you should not use wordpress but JS, as with JS you will be able to reuse at least some of the code for both server and client sides. As for using angular theme…. well the question is still why do you use wordpress at all as you … Read more

Send data from one WP instance to another and process it there

I solved it with mmm’s hint and created a simple custom REST endpoint. WP1 (Frontend, sending the data): function send_form_data_to_backend($form_values) { // add secret-key $form_values[‘secret_key’] = “abcde123″; $url=”http://backend.example.com/wp-json/example/v1/save/”; $response = wp_safe_remote_post( $url, array( ‘method’ => ‘POST’, ‘timeout’ => 15, ‘redirection’ => 5, ‘blocking’ => true, ‘headers’ => array(), ‘body’ => $form_values, ‘cookies’ => array() ) … Read more

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