Probably get_the_tags() is returning an empty array. Try changing the function to:
$my_tags = get_the_tags();
if ($my_tags){
foreach($my_tags as $tag) {
$tags[] = $tag->name;
}
}
Related Posts:
- Should all plugins be encapsulated in a Class?
- Consuming an external API in WordPress?
- How can I import a class privately into a plugin?
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Generate custom output for page/URL in a plugin
- Stackoverflow type of badge plugin giving warnings in WordPress 3.5
- Post source link plugin – small modification
- Add CSS animation as Preloader to WordPress
- How to list the Hooks and order of execution in current loading page? [duplicate]
- Setting up widgets in wordpress with a unique ID for the after_title argument
- Modifying Footnote Plugin for Descriptive Title Attributes
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- force customers to add only single item to card per purchase EDD [closed]
- Auto delete WordPress users according to time
- Edit Yoast SEO breadcrumbs output [closed]
- How would I go about creating a user ranked post popularity page?
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Redirect to another page using contact form 7? [closed]
- Inserting custom PHP script on homepage
- Loop in elementor custom widget not working
- I am trying to make a field show and save from quickedit screen
- .php file for woocommerce edit category? [closed]
- Customize Menu | Styling LESS/SCSS code formats
- Why is it important to check for isset and is_array before checking in_array in this example?
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- Calling a save function from a “submit” button
- Wp Debug Enabled True Notices and Warning
- same user role or copy the user role to be same as the other role
- woocommerce remove coupon link does not work
- implement custom roles in custom plugin
- Post source link plugin – small modification
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Adding discount functionality to the cart
- How to assign a specific service to a specific provider based on location
- Precheck fields when I add a new post
- Rename a folder via HTML POST request
- Move plugin pages from dashboard to front-end
- working code, not working – Plugin Dev
- Cron job shedules replace?
- Custom shortcode being shown in WPBakery backend rather than the block
- Move plugin upload folder from mywebsite.com/wp-content/uploads/pdfuploads to mywebsite.com/pdfs?
- Woocommerce list variations that are added already to cart in Single Product
- Flexslider empty slide
- Custom SportsPress list
- How to fix vanilla comments extra iframe space
- I want to remove the register/login WordPress top bar from my website
- How to delete remain data in WP database after deleting custom post via admin interface
- My wordpress site wont load, it gives header error warnings
- What can I do to customize a widget provided with this plugin? from where have I to start?
- WordPress: code structure
- How to make a Template page to show the information of different things Shop and Product page?
- Best collection of code for your 'functions.php' file [closed]
- Preserve custom URL parameter on more pages
- OpenID for WordPress 3.x? [duplicate]
- if plugin is active? check if plugin is enabled or not?
- Making plugin unique to not conflict with plugins with the same name
- How to store ACF custom fields data in a custom table
- Trying to disable plugins doens’t work
- Have Plugin Handle Specific URLs
- How to add equivalent of php include to one page (as plugin?)
- Does any one have Idea to get these functionalities with the plugin wp-multi-network
- Image upload and download from front-end
- How to call WordPress function other files
- Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?
- a weird attribute on every html tag
- Add bcc to contact from on wordpress
- Custom shortcode for displaying user based on a role parameter
- wp_enqueue_scripts
- Is there a way to easily manage Project options (custom-fields)
- Rename Smart YouTube’s httpv back to http for all posts
- Strange admin-ajax / CSS / $_SESSION issue
- How to create admin setting for this small plugin
- WordPress search input in database, to edit information via form and update the database
- Can we hide a certain user in WP?
- Remove a div class with condition
- Hooking into the HTML header container
- PHP Error message Upload images to remote server
- Block plugin update possibilities (but not by hiding notifications)
- WP_get_image_editor resizing images in a foreach loop
- Load my Inline js footer area
- Soflyy WP All Import Custom File Download Issue
- WordPress Admin sub-level menu issue
- Add class as plugin for other plugins
- Custom pages with plugin
- Displaying friend’s posts only
- Template from scratch: Sidebars not showing widget
- Contact Form 7: custom validation [closed]
- Enforce conditions only for draft posts using WyPiekacz, ignore pending and published posts
- Shortcode inside a redirect [closed]
- How to add custom html to the Media > Attachment Details modal?
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- How to disable plugin capability : “create new category”
- Option value not getting updated until page refresh in WordPress
- Fatal error: Uncaught Error: Call to a member function fetch_array() on bool
- I want create woocommerec match products columns
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- How to override plugin function in code snippets WordPress
- How to create a “Most Popular” & “Latest” TAB in WordPress
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class