The after_setup_theme hook is actually an action hook not a filter hook. Nonetheless that should not be needed.
Give this a try:
if( ! function_exists( 'get_field' ) ) {
function get_field( $key, $post_id = false, $format_value = true ) {
if( false === $post_id ) {
global $post;
$post_id = $post->ID;
}
return get_post_meta( $post_id, $key, true );
}
}
Related Posts:
- I have an fatal error on my funcyions.php
- How to override parent functions in child themes?
- Adding a second email address to a completed order in WooCommerce [closed]
- How to override a function when isn’t at functions.php
- functions.php inject inline css
- Removing custom background and header feature in child theme
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- syntax for remove_filter in parent theme with class
- Is it possible to override this function/class in a child theme?
- How to prevent deleting of comments when deleting a post
- Convert hyphen to underscore in permalinks
- Php string not working in WordPress Functions.php (trying to fetch 1st category for each blog that post appears in the sidebar)
- How to override filter in child theme?
- Customized wp_new_user_notification
- change default option in wp_dropdown_categories
- What is the criteria for pluggable functions?
- Where does function_exists() look to decide whether a function exists? [closed]
- How to use max and min values of custom fields
- Twenty Eleven Child theme error when attempting to use a rewritten function
- override pluggable.php functions
- Retrieve tags data in post body
- Run function when WordPress new multisite is created or ACF field is updated
- Having issues with a foreach inside of a shortcode with ACF gallery
- Override a theme function in a child theme?
- Get Current Post ID in functions php, meta query filter
- ACF not showing
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- How to target post and pages and not all post types in admin?
- wp_star_rating() – Adding a 5 star rating system to theme
- Add php code to wp_print_scripts?
- Access category within rss2_head hook?
- Need to replace Currency Shortforms
- Can set_post_thumbnail be used to remove a thumbnail?
- Programmatically add Yoast meta description after post save
- Compare meta key to current date in pre get post
- Check from functions.php if function exists in footer.php
- overwrite code snippet from parent to child theme
- Using two loops in one WordPress template
- Solution dealing with Child Theme / Parent theme functions
- How to override this theme function in child theme
- Insert a field with PREG_REPLACE – strange behaviour
- Perform function on publish AND save (not just save)
- Display ACF category image on archive and single template files
- WordPress login set cookie that survive browser exit (wp_signon function)
- Featured Image and Tags problem
- Override a Post’s URL with Advanced Custom Fields Function
- WordPress Function Assistance with Loop
- How to show ACF value under post/page title in wp-admin
- How to display an image before title text in menu items
- Filter works on last selection but no others
- Login cookies blocked after customizing hashing method
- How to update an image attachment’s alt text from a custom field when saving a post?
- Help with with my function for wordpress
- ACF Date Form in Custom Admin Field
- Assign IDs to headings in ACF using functions.php
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- get_field() with ID in one signal filter not working
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- Comment function for page
- ACF Filter return value
- WordPress reading old version of functions.php, breaks site
- Return ACF Field value function
- Different body image backgrounds on different pages, posts and categories
- update_post_meta not working in function
- Integrate WP Tiles into existing loop (index.php) and theme
- save_post hook – headers already sent?
- Retrieve array of attachment IDs attached to a given Post ID
- does acf_save_post cause endless loop?
- Call ACF data from functions.php [closed]
- Update post meta with wp cron
- How can I edit the wp_parse_auth_cookie function from the pluggable file in my functions?
- warning: trying to access array offset on value of type bool ACF field image group
- Uploading images via ACF update_field function
- (Divi): How to make WordPress load images of specific size for Blurb modules on given page with a funciton?
- Postback redirect through add_action is not triggered
- Warning and fatal error
- Appending „read more” to the excerpt conditionally
- Strip all HTML tags from product content and resave
- Auto remove tags on certain date
- Calling hooks in functions
- How to add class dynamically from templates
- Insert Modal on user first login
- Images with overlay
- Combine multiple menus using the filter wp_nav_menu_items
- Function for Sticky Post on Categories causes issues with 404 behavior
- How to offset main query without affecting other queries and backend
- How to display different blocks for mobile and desktops
- Prevent function from triggering on current page
- Using AJAX on frontend: Synchronous XMLHttpRequest deprecation except for admin role
- use add_action in a shortcode (gravity form – WordPress)
- Setting Up Child Theme To Take Priority
- Unable to declare AOS library in functions
- I want to customize the_posts_navigation function by replacing prev and next with images
- wp_footer hook causing text to show on bottom of page
- how to remove a tag in the_category function
- How to modify or override a core function (wp_star_rating)
- How Can I Concatenate A String With One Of My Custom Field Value Before Saving The Post?
- Classic TinyMCE messing up only Contributor’s HTML
- Load CSS file conditionally
- Only display table in the_content() in canonical page