wpup / functions
Bring functions into WordPress REST API
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 2
Open Issues: 0
Type:wordpress-plugin
Requires
- php: ^7.0
- composer/installers: ~1.0
Requires (Dev)
- frozzare/wp-test-suite: ~1.0
- wp-coding-standards/wpcs: dev-develop
This package is auto-updated.
Last update: 2024-10-29 05:46:41 UTC
README
Bring functions into WordPress REST API.
Example
Create hello.php
in wp-content/themes/NAME/functions/hello.php
<?php function handler($request) { return 'Hello, world'; }
Call it
GET /wp-json/functions/v1/hello
"Hello, world"
Supported HTTP methods for each function file are:
GET, POST, PUT, PATCH, DELETE
Namespaces and classes are supported as well.
<?php namespace MyNamespace; class MyClass { public function handler($request) { return 'Hello, world'; } }
Install
composer require wpup/functions
Filters
Short documenation about filters, read the source code to find out more about each filter.
functions_file
- Modify file pathfunctions_handle
- Modify function/method string name (that are used forcall_user_func
)functions_directories
- Modify which directories the plugin should scan for functions files. Default iswp-content/themes/NAME/functions
License
MIT © Fredrik Forsmo