Retrieving Advanced Custom Field within Shortcode Function [closed]

“You have to explicitly pass post ID as the 2nd argument.” – Milo In the Advanced Custom Fields plugin file, plugins/advanced-custom-fields/core/api.php, get_fields has a default $post_id of false, and calls on get_field_objects, which seems to run specific calls to $wpdb->get_col($wpdb->prepare, depending on what $post_id contains (is_numeric?, strpos(‘user_’)), so I guess depending on the environment of … Read more

Get custom field outside wordpress loop on new php page

ok got it myself didnt thought it would be that simple require_once($_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-load.php’); $postid = $_GET[“postid”]; $custom = get_post_custom($postid); { echo ‘<meta http-equiv=”refresh” content=”0; URL= ‘ . get_post_meta($postid, ‘custom-filed-key’, true) . ‘ “>’; }

How to check custom fields from functions.php

I don’t know if you need to hide the element completely, as in “never display it”, or if you need to hide it conditionally with JavaScript– say, to get a toggle effect. Either case is similar and would use get_post_meta(). To conditionally display the data use something like: $m = get_post_meta(get_the_ID(),’my_meta_key’); if(!empty($m)) { echo ‘<div>your … Read more

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