{"id":15928603,"url":"https://github.com/andrewleedham/wordpress-rest-api-extended","last_synced_at":"2025-07-10T16:34:26.002Z","repository":{"id":95918204,"uuid":"137088562","full_name":"AndrewLeedham/wordpress-rest-api-extended","owner":"AndrewLeedham","description":"Extends WordPress' REST API, allowing the Content-Type header to be specified.","archived":false,"fork":false,"pushed_at":"2018-07-03T13:33:53.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T23:34:41.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewLeedham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-12T15:03:42.000Z","updated_at":"2018-07-03T13:33:48.000Z","dependencies_parsed_at":"2023-05-15T19:30:52.775Z","dependency_job_id":null,"html_url":"https://github.com/AndrewLeedham/wordpress-rest-api-extended","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/AndrewLeedham/wordpress-rest-api-extended","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewLeedham%2Fwordpress-rest-api-extended","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewLeedham%2Fwordpress-rest-api-extended/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewLeedham%2Fwordpress-rest-api-extended/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewLeedham%2Fwordpress-rest-api-extended/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewLeedham","download_url":"https://codeload.github.com/AndrewLeedham/wordpress-rest-api-extended/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewLeedham%2Fwordpress-rest-api-extended/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264608135,"owners_count":23636684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T23:41:19.854Z","updated_at":"2025-07-10T16:34:25.969Z","avatar_url":"https://github.com/AndrewLeedham.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wordpress-rest-api-extended\nExtends WordPress' REST API, allowing the Content-Type header to be specified, and 404 errors to be raised.\n\n## Usage\nRegister a route that just returns HTML.\n```php\nregister_rest_route( 'namespace/v1', 'route' , array(\n    'methods' =\u003e 'GET',\n    'callback' =\u003e function(){return '\u003ch1\u003eHello World!\u003c/h1\u003e';}, // Callback can return a string that will be passed as the response.\n    'content_type' =\u003e 'text/html', // Specify any custom Content-Type.\n    'json' =\u003e false // Route content is parsed as JSON by default, so must be disabled.\n) );\n```\n\nregister_rest_route will still work as normal with JSON:\n```php\nregister_rest_route( 'namespace/v1', 'route' , array(\n    'methods' =\u003e 'GET',\n    'callback' =\u003e function(){return array('json': 'value');}\n) );\n\n// or explicitly:\nregister_rest_route( 'namespace/v1', 'route' , array(\n    'methods' =\u003e 'GET',\n    'callback' =\u003e function(){return array('json': 'value');},\n    'content_type' =\u003e 'application/json',\n    'json' =\u003e true\n) );\n```\nRegister a route that just returns a 404 error.\n```php\nregister_rest_route( 'namespace/v1', 'route' , array(\n    'methods' =\u003e 'GET',\n    'callback' =\u003e function(){return false;}, // Callback can return a false to trigger a 404 error.\n    'content_type' =\u003e 'text/html', // Errors will be returned as JSON regardless.\n    'json' =\u003e false\n) );\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewleedham%2Fwordpress-rest-api-extended","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewleedham%2Fwordpress-rest-api-extended","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewleedham%2Fwordpress-rest-api-extended/lists"}