The error is generated by this code:
line 27 $tags = get_the_tags();
line 28
line 29 $cn_sidebar="";
line 30 foreach($tags as $tg_id) {
If a post has no tags, get_the_tags()
wil return false. Then supplying false
to the foreach
statement will get you the error mentioned. In order to prevent this you should wrap the foreach
in if (!empty($tags)) { foreach ...}
.
Related Posts:
- the_date() not working
- How to return number of found rows from SELECT query
- WP-API v2 Custom Endpoint Response Formatting
- Get author full name
- Extract the first oembed url inserted on the content of a post
- WP API V2 returning Invalid User ID
- Why does $_SESSION only work when I am logged in?
- How to make an meta_query optional?
- How to show only parents subpages of current page item in vertical menu?
- Limit the_excerpt with max of x characters
- How to use copy() function and paste file in /wp-content/themes directory
- How can update custom meta for all posts
- Sanitize get_query_var() url parameters
- PHP/MySQL issues when running WP on EC2 cloud [closed]
- How to safely remove the footer (twentytwenty)
- ajax_object is not defined when ajax calls the function
- How do I fetch all comments per post via WP REST API?
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- wp_insert_post not working
- Add htaccess rules with insert_with_markers at beginning of htaccess
- Using More Tag in Combination with the_excerpt
- Add a custom stylesheet for BlackBerry
- Remove a filter added by a plugin
- putting Mailto: and Tel: into footer.php code wordpress
- understanding if statement [closed]
- How to select the contents in the text view textrea in wp_editor?
- WordPress Theme Options Values
- How to Sort posts by Vote Count?
- Logged in user ID as post ID
- Modifier l’affichage du prix sur la fiche produit
- How can I get a single php file that is the equivalent of an existing WordPress page?
- How to use $query->set with post__in?
- get_terms pagination
- PHP file won’t work in wordpress folder, but works in another virtual host
- WordPress homepage infinite redirect
- How to use thumbnail size of image if I’m only using src to get image
- Use URL Rewrite as well as $_GET parameters in URL?
- I want to add custom add to cart link [closed]
- How to add condition in wordpress loop? [closed]
- Output custom field value to post string
- If no image, bigger text
- showing 2 prices wholesale and normal
- wordpress wp_enqueue_script() not working
- Custom plugin settings link doesn’t append current class to menu item when visited? Why?
- WordPress admin-ajax.php 400 bad request
- Custom Background by Page IDs
- Error call_user_func_array() expects parameter 1 to be a valid callback when using image_size_names_choose
- What is the proper way to include a PHP framework into my theme?
- WordPress plug-in for dynamic download link?
- Help with page nav?
- Design with Elementor and code the rest?
- Can a plugin redirect product page based on IF condition?
- How to use mysql LIKE with wpdb?
- Get all posts as an array ID => Name
- How to store multiple custom meta box
- woocommerce related product title length
- cURL error 6 on news area, and also won’t auto update
- Do not duplicate posts with multiple categories in multiple loops
- Custom upload folder
- How to manually trigger a redirect to another page without changing the url address?
- How to use title attributes in sidebar widget?
- Displaying Event within two given time frames
- How to get my [shortcode] rendered on the home page, other pages are fine
- Display movies that apear this day next
- Wp favorites posts by specific category? [closed]
- How to add JS script in specific pages in WordPress?
- Fatal error login WordPress [duplicate]
- Pagination contents not changing in Front page WordPress
- How to select post ID for given parent name with nested prepared queries?
- How do I programmatically add ‘reviews_allowed’ to WooCommerce product?
- Why is values of a global variable returning blank when inserted into database
- How to return html as a string from php for WordPress
- Show Gutenberg facebook embed with a custom theme
- Add code to the header of posts by particular author
- Running a PHP SQL script on a wordpress page
- Can I disable auto increment of WordPress Posts Database to utilize previously deleted records?
- How to apply ‘add two more posts’ to media content?
- How to disable sub menu items from being created?
- Access to “My Site” is missing from the admin bar
- Unable to insert current username into custom table through html form
- add ‘publish metabox’ to Gravity forms edit page/form area
- load a wordpress page into another wordpress page using iframe
- How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?
- How can i iterate through this shortcode array?
- Explode Content within specific HTML element
- Using get_theme_mod with checkbox to display content
- How do I prevent a folder from reappearing in my home directory?
- Add specific content after specific text in every post
- Styling admin page rows in order of importance (checkboxes)
- On selecting shortcode generate selected shortcode table inside page editor worrdpress
- WordPress plugin creating sidebar on the theme/page
- Using existing widget code! [closed]
- Pagenav Not appearing on custom Template
- How To Customize Position of »add to cart« of WooCommerce on Product Page [closed]
- Automatically load WordPress page on server every XX hours
- PHP Puzzle: Unique Styles with PHP loop
- Open WordPress Page from selected option dropdown
- Deprecated: stripos(): Error in WordPress After Updating to php 8.1
- How can I display all these movies in DESC order by modified?
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page