-
Notifications
You must be signed in to change notification settings - Fork 0
Wordpress
Andreas Ekström edited this page Jul 11, 2026
·
4 revisions
Register WordPress menu positions in vitewp.config.ts:
export default defineConfig({
wordpress: {
menus: {
primary: 'Primary menu',
footer: 'Footer menu',
},
},
});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} />ViteWP discovers block metadata from src/blocks/**/block.json and bundles WordPress-side JS/TS and optional CSS.
src/blocks/hero/block.json
src/blocks/hero/edit.tsx
src/blocks/hero/style.css # optional