WordPress plugin intelligence profile

Headless Converter

Converts frontend to JSON response when request is done with certain conditions.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 5.9
Current version1.0.6
WordPress coverageTested up to WordPress 5.9
Minimum stackWP 5.6 · PHP 7.4
Directory statusactive
Last directory update28 Jan 20224y ago
Active installationsNewAdoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Headless Converter version 1.0.6 as active, updated 4y ago and tested up to WordPress 5.9.

Overview

About this plugin

Converts frontend to JSON response when request is done with certain conditions.

Inspiration

After creating a bunch of headless WordPress + Web app stacks, I wanted to find a standard and a all-round solution for fetching per page information for web applications inside WordPress. Built-in rest api works fine in basic cases, but it doesn’t support querying by path. Usually this meant that for each project developers would create a custom rest endpoint which would return expected content using content type and slug parameters.

WordPress has few built-in functions to retrieve content by path, url_to_postid and get_page_by_path, but they don’t seem to work with multilanguage plugins, taxonomy or archive pages, which means that WP doesn’t have a reliable way to fetch content this way through rest api.

6 feature) and a filter, which let’s developers alter outgoing data.

How to start using the plugin

  • Install and activate this plugin in your environment
  • Create application password for a user with administrator role

After above steps have been made, make a request to a page with added Authorization header. See data fetching examples at the end of this documentation for more help

Modifying the output

Plugin outputs current page’s Post object or null. This can be modified using headless-converter-modify-data -filter. You can either modify passed in post object or do your own logic like in the example below.

/** * Modifies Headless Converter plugin's output. * * @param WPPost|null $post - Current template's post object */ function modify_headless_converter_output($post) { if(is_404()) { return "this block renders 404 page content"; } else if(is_page()) { return "this block renders page post types content"; } else if (is_singular('post')) { return "this block renders single post content"; } else if(is_home()) { return "this block renders post archive"; } else { return $post; } }

add_filter('headless-converter-modify-data', 'modify_headless_converter_output');

Data fetching examples

Fetch

log)

Axios

const axios = require("axios")

page_id=2" const opts = { auth: { username, password } }

log)

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • converter
  • headless
  • json
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 5.9

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 5.9.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to5.9
Minimum requirementsWordPress 5.6 · PHP 7.4
Update activity28 Jan 20224y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.