A custom ACF field type that provides a drag-and-drop visual editor inside your WordPress.
- Drag & drop visual editor powered by GrapesJS
- Upload the
acf-visual-editor-fieldfolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- Make sure ACF (Advanced Custom Fields) is installed and activated
- Go to ACF → Field Groups
- Create or edit a field group
- Add a new field and select "Visual Editor" as the field type
- Set the editor height (optional)
- Assign the field group to your desired post type
<?php
$content = get_field('visual_editor_source');
if ($content) {
echo $content;
}const SITE_URL = "http://localhost:3000"
async function fetchVisualEditorData(postId) {
const apiEndpoint = `${SITE_URL}/wp-json/wp/v2/posts/${postId}`;
try {
const response = await fetch(apiEndpoint);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.json();
// Render the content
document.querySelector("body").innerHTML = data.acf.visual_editor_source.formatted_value;
} catch (error) {
console.error('Fetch error:', error);
}
}
// Example usage
fetchVisualEditorData(123); // Enter your Post ID