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
When you display the data for flex fields you shouldn’t be trying to get fields that aren’t associated with that particular layout.
$layout = get_row_layout();
if ($layout == 'layout_1') {
// show fields associated with layout 1
} elseif ($layout == 'layout_2') {
// show fields associated with layout 2
}
Just a basic example, could be far more complicated depending on what you’re doing. For example if 2 layouts have some fields in common then there might be function calls for those groups of fields.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.