retrieving external api data and updating existing custom post

Use the ACF field name, not the field key. This works: update_field(‘forecast_link’, $json_data[‘properties’][‘forecast’], $post_id); update_post_meta($post_id, ‘forecast_link’, $json_data[‘properties’][‘forecast’]); Use array keys to access nested data as needed. Reference (ACF Docs): https://www.advancedcustomfields.com/resources/update_field/

Generate list of posts on a page, but fill shortcode values from ACF fields on that page

I have actually found a really elegant solution to this myself. The issue is not with the [random-posts-list], it is with the script used to generate the [county] shortcode. Instead of using $post_ID = get_the_ID(); I should have been using $post_ID = get_queried_object_id();. This is a built-in WordPress query. With the above amend, I also … Read more

WP Query to display events and custom post type in a set order

I have implemented the following code to my them to achieve the custom ordering for featured events (first), regular events (second), and notices (third). New additions to the code include: Merged the posts using array_merge like this: $merged_posts = array_merge( $featured_events->posts, $future_events->posts, $notices->posts ); Ran a foreach to set a custom post order for featured … Read more

ACF Custom post type name changing issue

The answer to this should be rather simple. Please visit the settings page with the url settings. Just visit it. yoursite.com/wp-admin/options-permalink.php By doing so, WordPress should trigger the “Flush-Rewrite” hook, which creates a new .htaccess with the appropriate rules. However, please also be aware that depending on your custom-post-type some hooks in your code might … Read more

How to fix post_tags not showing for a CPT in new post for a custom user role?

Based on your code and capabilities setup, the issue occurs because the built-in Categories and Tags taxonomies require the primitive edit_posts capability for term assignment, but your Writer role only has custom capabilities like edit_stories. Here’s how to fix it: Solution: Map Taxonomy Capabilities to Your CPT Add this code to your theme’s functions.php or … Read more

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