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?
- WordPress 4.8.1 php getting commented
- Finding the screen id of a page generated with add_menu_page
- Control page content visibility based on URL parameter
- WooCommerce Shopping Cart Not Initially Showing Products [closed]
- Plugin not working & permalink erorr after upgrade to php 7x on Nginx
- How to include a custom field in the woocommerce email?
- How to translate wordpress error message
- Override a Plugin Function
- All custom widgets are not showing in widget area at the same time
- Add key and value to an array in another file
- Wierd site output [closed]
- Create “new pages” within the admin section of plugin
- More gentle way to hook WordPress custom url
- Send Array from JS to php file then insert it in wp database through a plugin
- Offer Download Links for Product Images
- How to list datas from database in a topic?
- Possible way of having multiple Gutenberg instances for a page?
- Woocommerce add products to cart
- How to hide an option from dropdown in filter module
- How to change “Read More” text?
- Using id to show item
- WP Migrate DB Pro plugin cannot transfer Media files to remote server
- Woocommerce – Change variations output
- WordPress Plugin PHP Not Calling Function
- How to send custom mail when a user complete a specific form
- Is admin section completely customizable in terms of styling?
- How to echo meta_key in easy digital downloads receipt (Purchase Confirmation page)
- Plugin error “array_key_exists(): The first argument should be either a string or an integer” [closed]
- Migrating custom php we wrote from functions.php into a site-specific plugin
- What is the correct entry point for capturing coverage data
- plugins_loaded action is not working properly
- Creating a user ‘add custom field’ section
- Conditional required fields for WordPress Contact Form 7
- Replace code in plugin template
- disable lightbox in a plugin [closed]
- How to Set Limit with WordPress Get Bookmarks Shortcode
- avatar displays outside of targeted area
- Remove the ‘Press This’ Tool
- How wordpress plugin hooks works? [duplicate]
- Selling Downloadable Products [closed]
- ACF: Hide a div or template section when a custom field (in a field group) is empty
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Populate Woocommerce order notes with custom field value
- Woocommerce Product Add-ons – Auto-select first option
- Warning: Undefined variable $admin
- public custom posts not showing in my wordpress plugin
- adding firstname and lastname on registration
- Plugin question, How to insert a colon in a value box
- Tickera missing attendees – No attendees found