Coder Social home page Coder Social logo

wp-rest-api-app's Introduction

WordPress Rest API APP

A Standalone Sample WordPress Rest API application with PHP

More about WordPress Rest API, visit: https://developer.wordpress.org/rest-api/

Requirement on WordPress site

#1 WordPress version 4.7 or later

#2 Installed plugin JWT Authentication for WP-API

#3 Installed plugin ACF to REST API

#4 Installed plugin Advanced Custom Fields

#5 Use file acf-fields.php on this repo to generate required ACF fields

Enable auth header

Add below lines to the bottom of the .htaccess file

# BEGIN WordPress JWT Auth
<IfModule mod_rewrite.c>
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</IfModule>
# END WordPress JWT Auth

JWT Authentication secret key

Add below lines to file wp-config.php

/** JWT_AUTH */
define('JWT_AUTH_SECRET_KEY', 'replace me with wordpress's salt string');

Set ACF to Rest API to request version 3

Add below line to file theme functions.php

define( 'ACF_TO_REST_API_REQUEST_VERSION', 3 );

Options Available

Set the WordPress site url and cookies timeout on file wp-rest-api-app.php

function __construct() {
	$this->site = 'http://localhost/wp-site/';
	$this->timeout_time = time() + 60 * 60 * 24 * 30; // 30 days
}

Screenshot

Screenshot

wp-rest-api-app's People

Contributors

harisrozak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.