# extendify/3.2.2/src/Agent/lib/linkable-pages.js

Extendify, version 3.2.2. 23 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.2.2/code/src/Agent/lib/linkable-pages.js
- Raw: https://pluginprobe.com/plugins/extendify/3.2.2/raw/src/Agent/lib/linkable-pages.js
- Modified: 2026-10-01T15:30:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.2.2/code/src/Agent/lib/linkable-pages.js#L10-L20`.

```javascript
import apiFetch from '@wordpress/api-fetch';
import { decodeEntities } from '@wordpress/html-entities';

// Root-relative, like the menu links a launched site starts with.
const pathOf = (link) => {
	const { pathname, search } = new URL(link);
	return pathname + search;
};

export const fetchLinkablePages = () =>
	apiFetch({
		path: '/wp/v2/pages?status=publish&per_page=100&_fields=id,title,link',
	})
		.then((pages) =>
			pages.map(({ id, title, link }) => ({
				id,
				title: decodeEntities(title?.rendered ?? ''),
				url: pathOf(link),
				link,
			})),
		)
		.catch(() => []);

```
