get_the_tags()
returns an array or false
on failure. (It appears it may also return a WP_Error
object under certain circumstances.)
It also requires a parameter: the post ID. You’re not passing that, so you’re not going to get the array your code expects.
Edit
You can’t just call get_the_tags()
— that’ll just get you a value of false
. You need to provide a post ID.
This might work: replace
$asrtags = get_the_tags();
with
$asrtags = get_the_tags( get_the_ID() );
…but note that this will only work if you’re in The Loop.
Related Posts:
- Pass media upload value to input field
- What does the token %1$s in WordPress represent [closed]
- Experiences with compiling WordPress using Hip Hop?
- WordPress redirect to landing page if not logged in
- PHP/Manual use of images? – 2 Questions
- Custom Yoast Breadcrumbs URL
- Debugging upload problem: What part of WP does actual image-resizing?
- Remove class that has been added by parent theme
- How to use a frontend URL with a Plugin
- Insert code when users come from an specific referer
- Get list of shortcodes from content
- Adding Google Analytics code to the tag of specific pages
- Add a Custom Class to Admin Menus
- Site Health : An active PHP session was detected
- login wp impossible
- Custom image upload
- How to scale image with equal width and height without distortion?
- How to display recent posts on home page with custom HTML
- Create Logout Link WordPress Admin Menu
- PHP 5.5, w3 Total Cache, and opcache [closed]
- How do I add text in a shortcode?
- How to display php source code inside a post using visual editor?
- PHP in post content [closed]
- Display post image with fancybox
- Attaching a pdf to Contact Form 7 e-mail via functions.php [closed]
- WordPress – how to replace with string on the_content() in single.php
- Getting array of customizer settings
- Ajax – Call to undefined function get_option()
- Display PHP within HTML values
- Show full posts in archive
- WordPress 3.2 query_posts and pagination, permalinks issue
- User management system similar to wordpress one?
- Implement One Time URL Script
- Call to undefined function wp() in wp-blog-header.php
- How does WordPress know wich language is chosen when there is a database connection error
- populate form fields in a loop with ajax
- Error in custom php function doesn’t exist
- How to pass Select value from Javascript to PHP to generate select option on change
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Contact form won’t submit
- Shortcode with PHP issue “Undefined index”
- Using same variable names in files added with get_template_part()
- Custom PHP script throws critical error ONLY when editing page
- Override a function defined in wp-includes/comment-template.php
- Querying Database with wpdb
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- How can i count the post added in relationship field, theme display
- How to get the last category name of a child category?
- How can I add a UTM tag with PHP code to pick up the post slug dynamically in the UTM?
- the_posts_pagination() not working in wpquery
- Using ob_start and ob_get_clean with wordpress shortcode
- Custom meta box values are not getting saved for my custom post type
- get post id from wp_insert_post for get_template_part
- Send notification email to admin for every new post published
- Retrieve Json data and create multiple pages with it
- How to add author’s posts link (HTML + PHP) inside a function to output it
- Accidentally deleted php code in WordPress website [closed]
- How to extract information from a wp_query result?
- WordPress Twenty Eleven PhP – forcing php code to skip first post on homepage?
- Cloning add_settings_field() with jQuery
- Display latest post from WordPress Featured Category that is also in X,Y,or Z categories
- Display Sibling WooCommerce Product Categories on Archive Page
- Problem with data collection in tables
- How to set value selected using select2 jquery plugin
- how to get sentence values from wordpress shortcode parameter?
- Disable send password change email to user wordpress
- Add custom HTML data to Contact Form 7 mail?
- How to update ticket price programatically when adding to cart and checkout in woocommerce
- How to use wp_get_attachment_image or wp_get_attachment_image_src instead of $instance[‘single_feature_image_uri’]
- Query by pagename not Working
- How can i avoid duplicate same post in wp?
- Fatal error: Uncaught Error: Class ‘WP_Block_Styles_Registry’
- AJAX and custom pages
- Custom meta box is not displaying value showing tag as empty
- Replace header with large image on home page only, using Genesis child theme
- Redirecting the lost password page request when using a custon login page
- How to make a vote in the poll for registered users?
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Running local copy of an old WordPress site on MAMP
- Add class for the_post_thumbnail_caption()
- Customizing WooCommerce with PHP
- Form not working as it should in WordPress, but in a normal HTML site it does
- Pagination reset problem
- Use get_option with $emailTo on contact page
- Weird Behaviour: Not all WordPress Posts appearing
- Adding ID to a Listing but not inside WP_Query while
- PHP in WordPress?
- Child theme not working properly
- Where to place PHP for shortcodes
- Hide a div from a particular page and single pages in WordPress
- How do I create a single WordPress page that will use PHP to include different HTML files based on a vaule in the URL?
- Create a custom page URL
- Facebook php sdk 4 getSessionFromRedirect() always null
- Getting custom field data from cart page to checkout page in woocomerce [closed]
- PHP Use Declared array Variable inside already Declared Array
- php grabbing every post made?
- Running a php code after User clicks a button? [closed]
- How to lock users account until approvation
- WooCommerce: write featured image dimensions to custom fields in product’
- transition_post_status hook, works – but not if the post is new