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
- Error message not appearing in error email or in the error log
- Why PHP Parse unmachet after update to PHP8?
- PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in Stack trace:\n#0 [internal function]: img_caption_shortcode()
- PHP Fatal error: Using $this when not in object context
- How to return number of found rows from SELECT query
- 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 use copy() function and paste file in /wp-content/themes directory
- Sanitize get_query_var() url parameters
- woocommerce and is_user_logged_in() if not redirect to homepage
- Adding a querystring to an image URL when clicking ‘insert into post’?
- Wrong links in WordPress?
- Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
- Is there any difference between get_the_title() and single_post_title()?
- How to download a txt file [closed]
- syntax issue on php 7.4
- Deregistering a script in WordPress seems impossible
- Common abstract class for plugins
- Where do posts get the sidebar from?
- putting Mailto: and Tel: into footer.php code wordpress
- understanding if statement [closed]
- Logged in user ID as post ID
- PHP file won’t work in wordpress folder, but works in another virtual host
- 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]
- two columns of posts on homepage, one of them “favorites”
- Help with .htaccess and Login with Subfolders
- Catchable fatal error on 3.6 update
- AJAX – Returning Two JSON Objects with One PHP Function
- Can’t Query Custom Table Using $wpdb Method
- How can I access string value in an array?
- Defined WordPress Memory Limit to Unlimited
- WordPress gallery shortag
- Shortcode to embed Edit Account form not working
- Errors after upgrading PHP to 7.4 WordPress
- WooCommerce – Moving Product Price to the Left of Add to Cart Button [closed]
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- How to make a conditional statement within $output in shortcodes.php?
- need help adding a new sidebar to a page that can’t use page-templates -> multisite
- How to list users like an archive page 10 users on page and have navigations
- WordPressUser Submission Form
- Strip from or something better?
- Add custom fields from different posts
- How do you get the current post taxonomy so I can get the current post taxonomy? into a variable to THEN loop through all post with that taxonomy.,
- Get nice name of category from slug (remove dashes of category)
- How to disable PHP functions in WordPress?
- switch_to_blog() + do_action(‘generate_footer’) not working in multisite
- How do I add a predefined class to a custom html element?
- Display post date also if the date it’s the same for each post
- How to access this jQuery/AJAX data in a PHP file/WordPress plugin
- Woocommerce – if selected attribute term equals
- split 1 cart item into instock and back ordered
- Display page content in different sections – based on page break block?
- WP Error using wp_insert_term
- Add class to all meta boxes for a custom post type
- Display posts using post ID’s in an array
- 403 Forbidden Localhost Wamp Apache Php
- Override 404 when navigating to single php file
- I’m writing my first plugin and my echo output is showing up on every page of my wordpress installation
- Beyond widget side menu editing, with the php page, custom template
- wp_delete_comment is doing nothing
- conditionally load a default static image if image metabox has no value
- How to add a code for lastpostdate after/inside a specific menu link?
- Query specific posts per user selections from dropdown menus
- php 7.0 update to 7.1 and at least 7.2
- Show div only if product has attribute
- Create guest author page via php
- Sorting a custom post type in pre_get_posts
- I have an error WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version
- YouTube embeds Cross-Origin Request Blocked (CORB) error
- How to change post date and post time in WordPress automatically with a function