get_term
can return a WP_Error
object in addition to a falsy value for term not found or an actual term row.
You fix this, by adding an additional check:
if (!$term) {
continue;
}
Becomes:
if (!$term || is_wp_error($term)) {
continue;
}
You should also do this above the get_term_link
call.
$term = get_term($value, $fieldSettings['taxonomy']);
if (!$term || is_wp_error($term)) {
continue;
}
$link = get_term_link($term);
get_term
usually returns a WP_Error
when the taxonomy doesn’t exist or isn’t registered (you can look at the source for more info). So much sure that it is. If you are registering it, make sure that the above code (that’s causing the error) is happening sometime after init
, where the taxonomy is probably registered.
Related Posts:
- Handle new created WP_Error
- How do iterate through all errors for a WP_Error object?
- Please Help Me, How to Fix PHP Error Undefined Array Key “srcset”
- How do I turn off WordPress errors and just have regular old php errors?
- Core error when calling remove_menu_page
- Cannot access non-wordpress subdirectories as wordpress overrides them with a 404 error
- Change login error messages
- Notice: Undefined index: host in /var/www/html/wp-includes/canonical.php on line 445
- Notice: Constant WP_POST_REVISIONS already defined
- How to stop certain warning logging in error.log?
- Debug mode shows Strict Standards
- Why on Earth am I getting “undefined_index” errors?
- Debugging ‘Object of class WP_Query could not be converted to int’ error
- Displaying oEmbed errors?
- “Apache HTTP Service has stopped working” with WP Query in WordPress 2.9.2
- Add image only in first post
- Showing “ Notice: Undefined variable:” and “ Notice: Trying to get property of non-object”
- Publishing Time – WordPress Plain White Screen with No Error
- New WordPress Error Message – Not seen this before
- Getting Warnings & Notices from Fresh WordPress 3.1.2 install
- Sodium compat error
- Fatal error: require(): Failed opening required ‘WP_DIRwp-blog-header.php’
- What do these “Failed to import” errors mean and how do I fix it?
- How to use add_settings_error in register_setting callback
- How to customize the critical error message?
- : Failed to load resource
- Error trying to publish immediately. Post status = future (Missed schedule error)
- Form Post results in 404 Not Found [duplicate]
- File does not exist – wp-index.php
- REST : how do you handle the rest_no_route error?
- “Undefined index” in wp-includes/media.php
- Sorry, you are not allowed to access this page dashboard
- Template administration Error after WP 4.8 update
- Homepage Not Found Error [closed]
- Error on moving WordPress site to Host from Local installation
- Visual editor become blank after updating an article
- Get errors from WP_Error to different variables
- Fatal error: Allowed memory size of 146800640 bytes exhausted (tried to allocate 57 bytes) in public_html/wp-includes/rewrite.php on line 1561
- Display all WP Errors together during form validation
- Updating posts exceeds maximum execution time
- Why can I not execute php files under the wp-includes folder?
- Headers already sent by
- Failed: Filesystem preventing downloads. ( ftpext)
- Code snippet to display ID gives critical error
- I tried to build a theme from scratch and it crashed everything
- Overwrote index.php. When I restored it, I got lots of Notice level errors
- 403 forbidden access to my whole site
- error log bloated by add_view
- Warning: require_once(/home/onetwo/public_html/wp-config.php): [closed]
- Unable to locate WordPress content directory
- Constant WP_CRON_LOCK_TIMEOUT already defined in /htdocs/wp-config.php
- WP Core Update Issue
- Cannot upgrade to 4.0 – get SSL certificate error
- Fatal Error: get_header();
- Error when setting cookie
- Downgrade from latest nightly build to latest stable version
- styles/default.css in markup, where does it come from? [closed]
- download count29.php whene loading site [closed]
- My new WordPress blog keeps refreshing in Chrome browser
- Undefined index error on options array element?
- Getting no Error Log File saved to my local directory, and no debug info displayed in the web browser
- How to turn off WP error handling, but turn on php error handling?
- Help with “Uncaught Error: Attempt to modify property “response” on bool”
- Error regarding invalid file permissions for upgrading WordPress version
- How to solve the error “Oops! That page can’t be found” when access Portfolio
- Replace form field error text?
- Publication in wrong category
- Suddenly get errors in admin when editing post type
- Why does this show up when i try to log in
- How can I make error messages in admin
- Error handling for wpdb error – displaying an error message to the user
- WordPress won’t save page/post with more than 332 words
- Dashboard widget, screen options/help doesn’t work?
- Getting amp; on every single category, post and page title. How to Remove?
- Site has fake users registered with a similar pattern in username and email
- WordPress fails when my post is larger than 1400 words
- Seeing “error” as text on white when accessing admin
- Unregister Settings Error
- Weird Parse Error on Uploaded File
- 500 internal server error with wordpress
- call user func array error after moved the site to new server
- do_action( ‘init’ ) in wp-settings.php breaks my website. All plugins and themes disabled
- Why I am having error Call to undefined function get_header()?
- WP_Error message
- Avoiding “headers already sent” in WordPress
- Fatal error: Cannot declare class WP_User_Request, because the name is already in use?
- Unexpected error with class-wp-hook.php on WordPress
- Fatal error: Call to undefined function wp_raise_memory_limit()
- problem ajaxurl – designthemes-core-features
- Help with overloading the limits of CPU/RAM issue in a resseler account with wp sites
- WordPress “Allowed memory size” on wp-db.php [closed]
- Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ [closed]
- Whole right area of wordpress admin dashboard not showing
- Only specific users timing out
- WordPress Customizer not loading
- Error Message – Cannot login to WordPress
- Is it possible to empty debug.log programmatically?
- File doesn’t exist! in wordpress function.php file while creating new post or page
- Change Registration Error Message
- Customizing login message