Support

Account

Home Forums General Issues Preventing errors

Unread

Preventing errors

  • Hi
    I am using ACF values with get_field() or the_field() from options pages in my theme.
    In the event that ACF is disabled, I want to prevent the site from displaying an error.

    Is the following code ok, or is there is better way?

    
    if (!class_exists('ACF')) {
    	function get_field(){
    		return;
    	}
    	function the_field(){
    		return;
    	}
    }
    

    Thanks

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.