{"id":22604552,"url":"https://github.com/shinshin86/wp-rest-api-posts-wordcount","last_synced_at":"2026-05-19T07:03:26.219Z","repository":{"id":41780197,"uuid":"377009467","full_name":"shinshin86/wp-rest-api-posts-wordcount","owner":"shinshin86","description":"Using the WP REST API, get the title, URL, content text, and number of characters in the content of all published articles of the target WordPress in JSON format.","archived":false,"fork":false,"pushed_at":"2022-12-31T03:20:12.000Z","size":546,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-02T14:18:55.732Z","etag":null,"topics":["wordpress","wp-rest-api"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/shinshin86.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}},"created_at":"2021-06-15T02:11:40.000Z","updated_at":"2021-12-04T00:00:17.000Z","dependencies_parsed_at":"2023-01-31T17:40:14.833Z","dependency_job_id":null,"html_url":"https://github.com/shinshin86/wp-rest-api-posts-wordcount","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/shinshin86/wp-rest-api-posts-wordcount","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinshin86%2Fwp-rest-api-posts-wordcount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinshin86%2Fwp-rest-api-posts-wordcount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinshin86%2Fwp-rest-api-posts-wordcount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinshin86%2Fwp-rest-api-posts-wordcount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinshin86","download_url":"https://codeload.github.com/shinshin86/wp-rest-api-posts-wordcount/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinshin86%2Fwp-rest-api-posts-wordcount/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263499191,"owners_count":23476021,"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":["wordpress","wp-rest-api"],"created_at":"2024-12-08T13:09:47.583Z","updated_at":"2026-05-19T07:03:21.168Z","avatar_url":"https://github.com/shinshin86.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wp-rest-api-posts-wordcount\n\n![Logo](./images/logo.png)\n\n[![Test](https://github.com/shinshin86/wp-rest-api-posts-wordcount/actions/workflows/test.yml/badge.svg)](https://github.com/shinshin86/wp-rest-api-posts-wordcount/actions/workflows/test.yml)\n\nUsing the WP REST API, get the title, URL, content text, and number of characters in the content of all published articles of the target WordPress in JSON format.\n\n## Install\n\n```sh\nnpm install wp-rest-api-posts-wordcount\n# or\nyarn add wp-rest-api-posts-wordcount\n```\n\n## Usage\n\nSupport `CJS/ESM/UMD`.\n\n### CommonJS\n\n```javascript\nconst getWordcountList = require('wp-rest-api-posts-wordcount');\n\n(async () =\u003e {\n  try {\n    const response = await getWordcountList('your wordpress url');\n    console.log(response);\n  } catch (e) {\n    console.error(e);\n  }\n})();\n```\n\n### ES Modules\n\n```javascript\nimport getWordcountList from('wp-rest-api-posts-wordcount');\n\ntry {\n  const response = await getWordcountList('your wordpress url');\n  console.log(response);\n} catch (e) {\n  console.error(e);\n}\n```\n\n### UMD\n\nAfter loading the script, it is available with the function name `GetWPWordcountList`.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width\" /\u003e\n    \u003ctitle\u003eUMD Sample\u003c/title\u003e\n    \u003cscript src=\"/node_modules/wp-rest-api-posts-wordcount/dist/umd/wp-rest-api-posts-wordcount.umd.cjs\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv\u003e\n      \u003cinput type=\"text\" id=\"url\" /\u003e\n      \u003cbutton id=\"search\"\u003eSearch\u003c/button\u003e\n    \u003c/div\u003e\n    \u003cscript\u003e\n      document.getElementById('search').addEventListener('click', async (e) =\u003e {\n        const url = document.getElementById('url').value;\n        const response = await GetWPWordcountList(url);\n        console.log({ response });\n      });\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nReturns the result.\n\n```javascript\n[\n  {\n    title: 'Post title',\n    url: 'Post url',\n    content: 'content text',\n    wordcount: word count(Number of characters in the content),\n    publishDate: '2020-01-01T00:00:00'\n  },\n  {\n    title: 'Post title',\n    url: 'Post url',\n    content: 'content text',\n    wordcount: word count(Number of characters in the content),\n    publishDate: '2020-02-01T00:00:00'\n  },\n  {\n    title: 'Post title',\n    url: 'Post url',\n    content: 'content text',\n    wordcount: word count(Number of characters in the content),\n    publishDate: '2020-03-01T00:00:00'\n  },\n  ...\n]\n```\n\n### Sort options\n\nIt is possible to sort by either wordcount or publishDate.\n\nwordcount: asc\n\n```javascript\nconst response = await getWordcountList('your wordpress url', {\n  sort: { wordcount: 'asc' },\n});\n```\n\nwordcount: desc\n\n```javascript\nconst response = await getWordcountList('your wordpress url', {\n  sort: { wordcount: 'desc' },\n});\n```\n\npublishDate: asc\n\n```javascript\nconst response = await getWordcountList('your wordpress url', {\n  sort: { publishDate: 'asc' },\n});\n```\n\npublishDate: desc\n\n```javascript\nconst response = await getWordcountList('your wordpress url', {\n  sort: { publishDate: 'desc' },\n});\n```\n\n## Development\n\n### test\n\n```sh\nnpm run test\n```\n\n## Licence\n\n[MIT](https://github.com/shinshin86/wp-rest-api-posts-wordcount/blob/main/LICENSE)\n\n## Author\n\n[Yuki Shindo](https://shinshin86.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinshin86%2Fwp-rest-api-posts-wordcount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinshin86%2Fwp-rest-api-posts-wordcount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinshin86%2Fwp-rest-api-posts-wordcount/lists"}