GET web api method from a WordPress PHP script

wp_remote_get was causing the issue and switch over to a curl solution. The code below replaced my old solution: $serverIP = ‘x.x.x.x’; $serviceAPI = ‘/Get_VacationRequest’; $jsonData = urlencode(json_encode($_REQUEST)); // Set up the server information where we will consume the API $url=”http://” . $serverIP . $serviceAPI . ‘?name=” . $jsonData; // Start the curl session $curl … Read more

How to create REST Based JSON API(how to modify the code below)?

try this: if (isset($_GET[‘api’])) { if ($_GET[‘api’] == ‘json’ && isset($_GET[‘id’])) { $args = array( ‘p’ => $_GET[‘id’], ‘post_type’ => ‘any’// ID of a page, post, or custom type ); $query = new WP_Query($args); // $query is the WP_Query Object $post = $query->post; // $post contains the post object header(“content-type: application/json”); echo json_encode($post); } exit(); … Read more

WordPress Security tools

There are many precautions you can (and should) follow. Select good hosting/server. Set strong passwords for your hosting and FTP accounts. Don’t use servers that allow remote connections to the DB. If you want to host multiple sites on one server, make sure they’re separated (so one site can’t access files from other sites – … Read more

Advice for Beginner in WordPress [closed]

Download XAMPP or WAMP and take some time to get familiar with it (it will set up a web server on your computer). You’ll have to copy the WordPress folder into the www/ or htdocs/, access it from your browser and start the WordPress installation. Most likely, you’ll want to make a custom theme for … Read more