Home Forums Bug Reports Flexible Content data still in wp_postmeta after layout removed Reply To: Flexible Content data still in wp_postmeta after layout removed

  • I just did a quick test.

    I created a flexible content field named 'flex_field'. This field has 2 layouts named 'layout_1' and 'layout_2'.

    I added this code to my template which is a trimmed down version of your code

    if (have_rows('flex_field')) {
      while (have_rows('flex_field')) {
        $layout = get_row_layout();
        if ($layout == 'layout_1') {
          echo '<p>LAYOUT 1</p>';
          echo '<p>',get_sub_field('content_1'),'</p>';
        } elseif ($layout == 'layout_2') {
          echo '<p>LAYOUT 2</p>';
          echo '<p>',get_sub_field('content_2'),'</p>';
    } else {
      echo '<p>NO ROWS TO DISPLAY</p>';

    Before editing the post I viewed it on the front then and the page displayed NO ROWS TO DISPLAY as expected. I added a layout_1 row and loaded the page. It displayed LAYOUT 1 as expected. I then deleted the layout row and added a layout_2 row. Layout 2 content was shown. I deleted the layout 2 row and once again NO ROWS TO DISPLAY was shown on the front page.

    I’ve looked at your code again and I don’t see anything wrong with it. If you are seeing content on the front end that should not be displayed then the problem is not with ACF as far as I can see. Try disabling other plugins on the site. Recheck the content that is added to your fields. Maybe there is some other plugin that is interfering with the updating of the field.

    While the data does stick around in the database, if the front end code is correct this content should not be displayed.