Support

Account

Home Forums Gutenberg Can't output values on frontend Reply To: Can't output values on frontend

  • Hi

    I am attempting a very similar thing to you but having the same problem. When I add a block, type some content into the editor, then deselect the block, and reselect it, the values I entered are missing.

    I have stripped it all back to a really simple test in my functions.php file as follows:

    acf_register_block(array(
    	'name'			=> 'my_test',
    	'title'			=> __('Test'),
    	'description'		=> __('A Test'),
    	'render_callback'	=> 'render_test',
    
    ));
    
    function render_test() {
    	$title = get_field('title');
    	$content = get_field('content');
    
    	?>
    
    		<h2><?php echo $title ?></h2>
    		<?php echo $content ?>
    
    	<?php
    }

    My template is simply:

    <?php get_header(); ?>
    
    <?php the_content() ?>
    
    <?php get_footer(); ?>

    I am using 5.8-beta3. I am at a bit of a loss as to what is going on. If anyone could give me any suggestions, I would really appreciate it!!

    Many thanks
    David