Plugin – Json Articles

Plugin - Json Articles

Posted:  October 14, 2021

Plugin - Json Articles

Back when I was attempting to be a small hosting business in Western Mass, I ran a side site for supporting my clients where I wrote most of the articles you now see here. In addition to displaying them on my support site, I also wanted to be able to display them on the companies main site.

Rather than rewriting, or exporting/importing the articles, I decided to leverage the built-in WordPress Rest API and wrote this plugin to do it all for me.


What this plugin does is pulls in articles from another WordPress site through the normal json endpoints, it then parses the categories, tags, and attempts to pull the media. You can change the permalinks for each, create a sidebar and add widgets to existing sidebars.

We do inject an “Original Article” with the link back to the original page. You cannot remove this link through the plugin, please do not hack it to remove and give credit where credit is due!


  • Ability to pull blog articles from another WordPress website
    • Configured site must have the JSON API enabled.
  • Creates or Updates posts, categories, tags, and tries to create the media for the posts
  • Configurable and filterable by category, tag, or date range of articles to pull.
  • Configurable permalinks
  • Number of articles to pull (max 100, this is a WordPress JSON API limit)
  • Manual, cron, and cli based syncing.
    • I would not recommend manual syncing for anything over 20 articles
  • Includes basic templates
    • To use them, simply copy the files in this plugins templates/ directory to your theme’s root directory and make your modifications.

Directions & Settings


  • Download the plugin, unzip it, and upload to your sites /wp-content/plugins/ directory
    • You can also upload it directly to your Plugins admin
  • Activate the plugin through the ‘Plugins’ menu in WordPress

Settings & Sync

Main Settingsmain settings

  • Site URLThe full URL to the site you wish to attempt to pull articles from, ex… http(s)://yoursite.comNOTES: The site you are pulling from must allow the JSON API, and you do not need to know the endpoints for the posts, the plugin takes care of that for you.
  • Article PermalinkThe base permalink for displaying the articles.
  • Category PermalinkThe base permalink for displaying the article categories.
  • Tag PermalinkThe base permalink for displaying the article tags.
  • Article Display CountHow many articles should be displayed per page?
  • Article Pull CountHow many articles should the sync pull?NOTE: WordPress JSON only allows a maximum of 100 articles.
  • Category Filter Comma-delimited list of categories from the originating site to pull the articles from.NOTE: Defaults to all Categories
  • Tag Filter Comma-delimited list of tags from the originating site to pull the articles from.NOTE: Defaults to all Tags
  • Date Filter – Start “Published On” start date pull the articles from the originating site.NOTE: Defaults to all
  • Date Filter – End “Published On” end date pull the articles from the originating site.NOTE: Defaults to all

Sync Settingssync settings

  • Sync Span Select the span of time that you would like to sync the articles. Pulls the pre-exising WordPress scheduling.
  • Manual Sync Click to manually sync the articles, please stay on the page while it is running to prevent any interuptions.NOTE: I do not recommend doing this for any pull over 10 or so articles. It could timeout.
  • CLI Sync Log into your webservers shell, and run the following command in your sites root: wp kp_ja sync.NOTE: If your site is a multisite install, specifically a subdomain type, please add this flag to your command: --url=http(s)://THEURLTOYOURSITE.ext

Sidebar & Widgets

  • Sidebar – JSON Articles We added a sidebar for use in the article templates if you need to.
  • Widgets
    • JSON Article Categories Works exactly like the built-in “Categories” widget, except pulls from these JSON Articles.
    • JSON Article Tags Displays a tag cloud of the JSON Articles Tags.
    • JSON Recent Articles Displays a menu of the most recent JSON Articles.

Articles and Templates

  • Files – main location: wp-content/THISPLUGIN/templates/*To override our template simply copy them to your themes root directory, and make your modifications.
    • kpja-archives.php This is the main article listing page, just like your archive.php or index.php template files.
    • kpja-category.php This is the article category listing page, just like your category.php template file.
    • kpja-single.php This is the single article page, just like your single.php template file.
    • kpja-tag.php This is the article tag listing page, just like your tag.php template file.


= 0.7.14 =
* VERIFY: Core 5.8.1 Compliant

= 0.7.13 =
* FIX: remote pull issue on non-https
* FIX: throw proper error messages on issue
* FIX: proper OR for file DIE on direct access
* FIX: properly pull the documentation and sync info pages
* FIX/FEATURE: replace get with safe get
* FEATURE: strongly type methods
* FEATURE: updated comments to phpdoc format

= 0.6.97 =
* framework update
* 5.8 compatibility
* force php 7.3 minimum

= 0.3.13 =
* framework update
* WP Core Version update

= 0.2.07 =
* Check for existing classes
* Test for 5.7 compliance
* Remove un-necessary includes
* CLI sync performance
* Update field framework

= 0.1.91 =
* First public release


Kevin Pirnie

20+ Years of PC and server maintenance & over 15+ years of web development/design experience; you can rest assured that I take every measure possible to ensure your computers are running to their peak potentials. I treat them as if they were mine, and I am quite a stickler about keeping my machines up to date and optimized to run as well as they can.