I would say you are probably receiving a WP_Error on first run.
around the $maxitems
and $rss_items
lines, add:
if( ! is_wp_error( $rss ) ) {
$maxitems = $rss->get_item_quantity(3);
$rss_items = $rss->get_items(0, $maxitems);
}
As seen in the example.
Related Posts:
- “Maximum function nesting level of ‘100’ reached” after adding a new filter
- apache cpu over 70% on localhost
- Fatal Error relating to sessions.php
- wp_ob_end_flush_all and wp_suspend_cache_addition()
- fatal error call to undefined function get_header in index.php on line 1
- Getting error when using wp_insert_post()
- Fatal Errors on pluggable.php
- Syntax error in a shortcode function
- Fatal errors to undefined function in theme 404.php file [closed]
- PHP Helper Class to create shortcodes
- wordpress admin part is not accesbile after server shifting
- Error while loading wordpress site “Fatal error: Uncaught Error: Call to undefined function twentytwentyone_the_html_classes() in /home
- Connecting to upstream failed
- Fatal error: wp-settings.php on line 199
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- Fatal Error cannot log into wordpress and website disappeared
- pages disable after wordpress update
- Importing demo data in Multisite
- WordPress error on my website
- Changed URl in General Settings now WordPress site doesnt work
- WordPress won’t display errors at all
- WP white screen of death after duping a site that works fine on same server
- Catchable fatal error in appcloud free theme by Tokokoo
- Front-end major break after upgrade PHP 8.0 [closed]
- kali php problem [closed]
- Divi – add title to mobile menu button
- WordPress critical error after trying to update to 6.2 – Fatal error: Allowed memory size of 268435456 bytes exhausted
- User registration followed by automatic login
- WordPress and event-driven programming – what is it about?
- How WordPress encrypt password? [duplicate]
- wp_insert_user role not working
- Adding a custom image upload size and making it selected by default?
- How to paginate a list of custom taxonomy terms?
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- reason of splitting theme files to multiple files
- Limit the Excerpt field in WP-Admin in words
- Problem with Woocommerce REST API Authentication
- Does WordPress need the eval function?
- wp_mail not sending
- Returning a value from a PHP page
- PHP Date display as time ago
- Pass get_option value to an array [closed]
- Strip characters, Including spaces, for tel: link
- Can’t get page content in WordPress
- how could I load a different template part by page
- Notice : add_theme_support( ‘post-formats’ ) was called incorrectly [closed]
- How to call plugin function per site in a multisite?
- How to Internationalize WordPress – Extract strings with textdomains, per textdomain individually
- How to make own crop image function for WordPress plugin
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- need help with existing code showing subpages
- Showing latest post without 301 redirect
- Display custom field on 404 page outside loop
- Pagination broken on is_front_page()
- Why doesn’t PhotoSmash plugin play well with wp_query?
- $_SESSION variables work perfectly on my local machine but returns NULL on development webserver
- Integrating Yii2 and WordPress
- PHP E_WARNING being shown despite php.ini [closed]
- After disabling WPML multi currency, the currency is still handled by the WPML
- preg_replace on all HTML content in WordPress
- Post class only applying to first excerpt; why?
- PHP Warning: preg_match() expects & PHP Warning: strip_tags()
- Limit the number of child pages
- how to get wordpress page url php code [duplicate]
- How to show upcoming events according to start date field
- Some problems in custom widget
- Call a function in functions.php from within tags (JS)
- Can I ‘order by’ date that is in a text field?
- Show related products by attribute based and certain conditions
- How to retrieve taxonomy Metabox fields in frontend
- Is there a PHP function that will return the block ID generated by WordPress?
- retrieve “Link Color” value
- Creating a Function and Call It
- How to count active users on a specific page
- WooCommerce display price before add to cart [closed]
- Adding column to wpex_users
- WordPress ajax filter returning all posts when it should be filtering by category
- WooCommerce Quantity in Dropdown menu instead of clasic [closed]
- Trying To Call a Dynamic Email Address
- How to override html codes in wordpress?
- Create html tree sitemap
- Plugin Modification Change Functionality For Logged User Only
- redirect 301 with special character like WIX site “#!”
- Display tab title as ‘blog tagline | blog title’
- Conditional statement within WP SQL query
- Modify category archive page loop on functions.php
- How to display html code on homepage
- two wordpress sites, two themes, one database, same content
- Display a query with multiple post types and same relationship on a single page
- Check if values exists DB
- Trying to exclude posts from a category on the home page
- Php conditional help needed
- wp_link_pages return value even when is condition inside if statement
- How to quickly/easily make an analysis (reverse engineering) of WordPress?
- New to wordpress. Need Help with templates [closed]
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- Help with if/else loop [closed]
- Find owner of coupon
- WordPress wp_remote_request() – How to do async await in wordpress php?
- How Create Automatically Image jpg.webp from image .jpg without delete or change original images upload