Fatal Error Call To Undefined Function Get_field
Contents |
error: Call to undefined function the_field_return() Tagged:error, function, the_field_return uberspeck November 22, 2013 at 1:37 pm I've inherited a WP project that uses v2.0.5 of ACF. I'm attempting to bring it up
Fatal Error Call To Undefined Function The_field
to date. After updating the plugin I've started to get the following wp call to undefined function get_field error… Fatal error: Call to undefined function the_field_return() Googling for it returns no results and this forum doesn't seem fatal error call to undefined function wordpress to return any either. Anyone have any suggestions? I'm new to ACF so I'm starting from scratch… Elliot November 22, 2013 at 5:00 pm Hi @uberspeck the_field_return is not a function
Fatal Error: Call To Undefined Function Php
known to ACF. Please use get_field instead. Visit the docs to see all available functions. Thanks E uberspeck November 23, 2013 at 2:59 am Hi Elliot, thanks for the quick response! I dug through the archive of the site (before I updated ACF) and I came across the method in api.php. Maybe the previous developer added it? Maybe if I add it
Call To Undefined Function Wp_removable_query_args()
to functions.php that will take care of it? // the field return function the_field_return($field_name, $post_id = false) { //echo 'field name: '.$field_name.', post id: '.$post_id; $value = get_field($field_name, $post_id); if(is_array($value)) { $value = @implode(', ',$value); } return $value; } Elliot November 24, 2013 at 2:56 pm Hi @uberspeck Yes, this looks like a custom function added to the plugin. I would move this to your theme functions.php file, or just use the standard get_field instead. Thanks E Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Welcome Welcome to the Advanced Custom Fields community forum. Browse through ideas, snippets of code, questions and answers between fellow ACF users Open a new forum thread Forums General Issues Front-end Issues Backend Issues (wp-admin) ACF PRO Add-ons Bug Reports Feature Requests Feedback Helping Others Helping others is a great way to earn karma, gain badges and help ACF development! Help solve topics Stay up to date with ACF news The Advanced custom fields plugin is proudly created and maintained by Elliot Condon Copyright 2016 Elliot Condon
template lowercase January 9, 2014 at 6:28 am I have a template file with the following code. '); if ($recentposts) { foreach($recentposts as fatal error: call to undefined function wp_removable_query_args() in $post) { setup_postdata($post); ?> The custom field named ‘artist_news" should return
Wordpress Call To Undefined Function Wp_removable_query_args()
an id in a numerical form (for example '22'). This is not working though. Any ideas why I wp_convert_hr_to_bytes() can't place the php field call in my code like this? The end result should be like this… https://support.advancedcustomfields.com/forums/topic/fatal-error-call-to-undefined-function-the_field_return/ How would I get my custom field value to render in my code? Will January 9, 2014 at 7:47 am Try this: Not exactly sure how WordPress functions handle variables inside of strings like that so you might need to do this: lowercase January 9, 2014 https://support.advancedcustomfields.com/forums/topic/the_field-not-working-in-a-template/ at 8:36 am So does this repalce ALL of my above code or do I integrate it somehow with mine? When I replace it with your code I get an error… fatal error: Call to undefined function get_the_field() Will January 9, 2014 at 10:17 am Sorry about that. I'm drunk. It's get_field, not get_the_field. lowercase January 9, 2014 at 3:58 pm We have a winner! thanks very much for the help. Final working code here for those in the future… Viewing 5 posts - 1 through 5 (of 5 total) You must be logged in to reply to this topic. Welcome Welcome to the Advanced Custom Fields community forum. Browse through ideas, snippets of code, questions and answers between fellow ACF users Open a new forum thread Forums General Issues Front-end Issues Backend Issues (wp-admin) ACF PRO Add-ons Bug Reports Feature Requests Feedback Helping Others Helping others
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us http://stackoverflow.com/questions/23562157/cant-use-get-field Learn more about Stack Overflow the company Business Learn more about hiring developers http://wordpress.stackexchange.com/questions/182279/fatal-error-call-to-undefined-function-get-post-with-ajax or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Can't use get_field() up vote 0 down vote call to favorite I have a working AJAX function that sends a variable to a page I made within the template directory. I am using Advanced Custom Fields and execute the get_field($name, $id) function, but I get a 500 server error. I looked in my error log (Apache) and saw that it got an undefined function error. That's strange, because when I use it on front-page.php it actually works. call to undefined [Fri May 09 11:56:19.336469 2014] [:error] [pid 2235] [client 192.168.1.111:54118] PHP Fatal error: Call to undefined function get_field() in /var/www/html/wp-content/themes/Custom Theme/setphoto.php on line 4, referer: 192.168.1.115/ PHP JavaScript $(".a_item").mouseover(function(){ // Krijg url + id van href var href = $(this).attr("href"); var p = href.replace("http://192.168.1.115/?p=", ""); var xhr = new XMLHttpRequest(); xhr.open("GET", "wp-content/themes/HSV Saints/setphoto.php?p="+p, true); xhr.send(); xhr.onload = function(){ console.log(xhr.responseText); } // $("#photo_news_photo").attr("src", img_url); }); How can I enable WordPress to use get_field in an external file within my template directory? ajax wordpress share|improve this question edited Apr 13 at 13:06 Rob 9,58662442 asked May 9 '14 at 10:21 user3510787 44 Can you show your code. –Mr.Happy May 9 '14 at 11:26 1 I have addes my JavaScript code, but that's not the problem. The problem is that Advanced Custom Fields somehow is not enabled on that page or something, it does not recognise the function... –user3510787 May 9 '14 at 12:10 Any idea? I'm like stuck on this –user3510787 May 9 '14 at 14:02 add a comment| active oldest votes Know someone who can answer? Share a link to this question via email
tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us WordPress Development Questions Tags Users Badges Unanswered Ask Question _ WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Fatal error: Call to undefined function get_post() with ajax up vote 0 down vote favorite 1 I have an index.php page with about link, which will get about author content from created page (post) inside WordPress dashboard with name about. I'm using Magnific Popup plugin for poups. I have about.php which includes content of about page like this:
post_title; ?>