Skip to content

Wordpress

Andreas Ekström edited this page Jul 11, 2026 · 4 revisions

WordPress hooks in Astro

Astro templates can ask the internal WordPress runtime to render real WordPress actions and filters during SSR:

---
import { createHooks } from 'vite-wp/wordpress/hooks';

const hooks = createHooks(Astro.props);
const head = await hooks.action('wp_head');
const content = await hooks.filter('the_content', Astro.props.content);
---

<Fragment set:html={head.rendered} />
<article set:html={content.value} />

Clone this wiki locally