I created custom post type and custom taxonomy. But I use ACF, and is need to get ID of current page Post type is 'objects'. Custom taxonomy is "objects_category". And page name taxonomy-objects_category.php
This code no works
$two_cols_catalog_left = get_field('two_cols_catalog_left');
echo $two_cols_catalog_left;
But this code works
$two_cols_catalog_left = get_field('two_cols_catalog_left', 47);
echo $two_cols_catalog_left;
47 - is ID of current page.
But is need to type
$two_cols_catalog_left = get_field('two_cols_catalog_left', $page_id);
echo $two_cols_catalog_left;
How is possible to get ID of current page?
get_field
without a post ID parameter you need to be within the "loop". So ensure you've initiated the loop when you're using it and you wont need to manually get the ID.