Get Custom Field Values by Another Custom Field in WordPress

After struggling with this, I found a workaround that worked. Since every custom field has a connection with my custom post type, I was able to use wp_get_object_terms to get the terms for each custom taxonomy. Using the query to retrieve all posts: $args = array( ‘post_type’ => ‘houses’ ); $houses = new WP_Query($args); $posts … Read more

ACF get field label in custom code

Try this, which worked for me: <?php $fields = get_field_objects(); // I changed from get_fields() if( $fields ): ?> <ul> <?php // I changed $value to $field (i.e. the variable name) foreach( $fields as $name => $field ): if (stripos($name, ‘isbn’) !== false) : ?> <li><b><?php echo $field[‘label’]; ?></b> <?php echo $field[‘value’]; ?></li> <?php endif; … Read more

Query pages for use of a flexible content layout

I posted this on the ACF support forum as well and got great feedback: https://support.advancedcustomfields.com/forums/topic/query-pages-for-use-of-a-flexible-content-layout/ With a bit of tweaking, it worked. Here’s what I ended up with: <?php $flex_content_name=”flexible_content”; // < update with applicable field name $layout_name=”featured-resources”; // < update with applicable subfield name $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘page’, ‘meta_query’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)