{"id":23283570,"url":"https://github.com/magicink/use-wordpress","last_synced_at":"2025-08-21T15:33:45.579Z","repository":{"id":38417261,"uuid":"202914153","full_name":"magicink/use-wordpress","owner":"magicink","description":"Useful React Hooks for WordPress","archived":true,"fork":false,"pushed_at":"2023-07-09T18:05:03.000Z","size":368,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-06-27T17:02:13.044Z","etag":null,"topics":["hooks","react","wordpress"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicink.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-08-17T17:45:45.000Z","updated_at":"2024-10-06T21:52:47.000Z","dependencies_parsed_at":"2024-12-20T01:33:15.286Z","dependency_job_id":null,"html_url":"https://github.com/magicink/use-wordpress","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":0.5135135135135135,"last_synced_commit":"d2e3eb3f9e7a0eae0a0d7170a31db14eef7c9bbf"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/magicink/use-wordpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicink%2Fuse-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicink%2Fuse-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicink%2Fuse-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicink%2Fuse-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicink","download_url":"https://codeload.github.com/magicink/use-wordpress/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicink%2Fuse-wordpress/sbom","scorecard":{"id":611721,"data":{"date":"2025-08-04","repo":{"name":"github.com/magicink/use-wordpress","commit":"d2e3eb3f9e7a0eae0a0d7170a31db14eef7c9bbf"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":1.3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'develop'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T02:49:53.226Z","repository_id":38417261,"created_at":"2025-08-21T02:49:53.226Z","updated_at":"2025-08-21T02:49:53.226Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271500374,"owners_count":24770377,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["hooks","react","wordpress"],"created_at":"2024-12-20T01:22:29.572Z","updated_at":"2025-08-21T15:33:45.343Z","avatar_url":"https://github.com/magicink.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.org/magicink/use-wordpress.svg?branch=develop)](https://travis-ci.org/magicink/use-wordpress)\n\n# Overview\n\nUseful React Hooks for WordPress.\n\n### Installation\n\n`npm i -D use-wordpress`\n\n### Requirements\n\nThis library relies upon an implementation of WHATWG `fetch` and `URLSearchParams`.\n\n## Initialization\n\n### `useWordPress(nonce: string, baseUri: string)`\n\n#### Usage\n\n```js\nimport React from 'react'\nimport { useWordPress } from 'use-wordpress'\nexport const TestComponent = props =\u003e {\n  const { data, get, total, totalPages } = useWordPress(wpApiSettings.nonce)\n  const [initialized, setInitialized] = React.useState(false)\n  React.useEffect(() =\u003e {\n    if (!initialized) {\n      get('categories') // Fetches categories and assigns them to data\n      setInitialized(true) \n    }\n  }, [])\n  return (\n    // ...\n  )\n}\n```\n\n#### Arguments\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `nonce` | `string` | yes | |  A \"number used once\" to help protect URLs and forms from certain types of misuse. [Learn more about nonces](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/). |\n| `baseUri` | `string` | no | `?/rest_route=/wp/v2` | The base URI of WordPress's REST API. |\n\n## API\n\n### Properties\n\n| name | type | description |\n|---|---|---|\n| `data` | `any` | The response from the fetch call. |\n| `embedded` | `Object` | Stores the `_embedded` property of an entity if it exists. |\n| `featuredMedia` | `Array\u003cObject\u003e` | Stores the `wp:featuredmedia` array of `embedded` if it exists. |\n| `error` | `Error` | Any errors returned from the fetch calls. |\n| `loading` | `boolean` | Whether or not a fetch is currently being performed. |\n| `total` | `Number` |  The total number of records in the collection. |\n| `totalPages` | `Number` | the total number of pages encompassing all available records. |\n\n### Methods\n\n#### `fetchData (endpoint: string, callback: Function, headers: Object)`\n\nA wrapper for `window.fetch()`. Populates `total` and `totalPages` with the values of `x-wp-total` and\n`x-wp-totalpages`, respectively, if they are present in the response header.\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `endpoint` | `string` | yes | | The portion of the URI that is appended on the base URI passed into the initializer. |\n| `callback` | `Function` | yes | | A callback that invoked upon a successful fetch request. |\n| `headers` | `Object` | no | | Headers passed to the fetch call. |\n\n#### `get (type: string, options: {[key: string]: string}, getEmbedded: boolean)`\n\nUsed to fetch a collection of `type`.\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `type` | `string` | no | `posts` | The type of record your are fetch (i.e `posts`, `pages`, `categories`). |\n| `options` | `SearchParams` | no | `{}`| An object that is converted into search parameters. |\n| `getEmbedded` | `boolean` | no | `false` | If `true` it will add the `_embed` search parameter to the fetch. |\n\n#### `getById (id: number, type: string, options: {[key: string]: string, getEmbedded: boolean)`\n\nUsed to fetch a record by its ID.\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `id` | `number` | yes | | The ID of the record your are trying to fetch. |\n| `type` | `string` | yes | `posts` | The type of record your are fetch (i.e `posts`, `pages`, `categories`). |\n| `options` | `SearchParams` | no | `{}`| An object that is converted into search parameters. |\n| `getEmbedded` | `boolean` | no | `false` | If `true` it will add the `_embed` search parameter to the fetch. |\n\n#### `getBySlug (slug: string, type: string, options: {[key: string]: string, getEmbedded: boolean)`\n\nUsed to fetch a record by its slug.\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `slug` | `string` | yes | | The slug of the record your are trying to fetch. |\n| `type` | `string` | yes | `posts` | The type of record your are fetch (i.e `posts`, `pages`, `categories`). |\n| `options` | `SearchParams` | no | `{}`| An object that is converted into search parameters. |\n| `getEmbedded` | `boolean` | no | `false` | If `true` it will add the `_embed` search parameter to the fetch. |\n\n#### `getEmbedded (entity: {'_embedded': Object})`\n\nStores the `_embedded` of `entity` if it exists. The value of `_embedded` is assigned to `embedded` (see \"Properties\").\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `entity` | `{'_embedded': Object}` | yes | | The data source. |\n\n#### `getFeaturedMedia (embedded: {'wp:featuredmedia': Array\u003cObject\u003e})`\n\nStores the `wp:featuredmedia` of `embedded` if it exists. The value of `wp:featuredmedia` is stored in `featuredMedia` (see \"Properties\").\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `embedded` | `{'wp:featuredmedia': Array\u003cObject\u003e}` | yes | | The data source. |\n\n#### `getPageById (id: number, options: Object, getEmbedded: boolean)`\n\nA wrapper for `getById` used to get a page by its ID.\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `id` | `number` | yes | | The ID of the page. |\n| `options` | `SearchParams` | no | `{}` | An object that is converted into the request search params. |\n| `getEmbedded` | `boolean` | no | `true` | If `true` the request will also fetch embedded objects. |\n\n#### `getPageBySlug (slug: string, options: Object, getEmbedded: boolean)`\n\nA wrapper for `getBySlug` used to get a page by its slug.\n\n| name | type | required | default | description |\n|---|---|---|---|---|\n| `slug` | `string` | yes | | The slug of the page. |\n| `options` | `SearchParams` | no | `{}` | An object that is converted into the request search params. |\n| `getEmbedded` | `boolean` | no | `true` | If `true` the request will also fetch embedded objects. |\n\n## Data Types\n\n#### `SearchParams`: `{[key: string]: string}`","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicink%2Fuse-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicink%2Fuse-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicink%2Fuse-wordpress/lists"}