This late in the process you should be able to rely on context set up, even outside of loop.
On top of my head something like this should work:
$categories = wp_get_post_categories( get_the_ID(), [ 'fields' => 'names' ] );
Related Posts:
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- Adding a custom line of text to php code
- plugins_url() incorrectly returns a url with www subdomain
- Getting media library popup in custom plugin admin page
- How to add pagination to wpbakery grid?
- How to write one comment and publish on every post using database or plugin?
- Why wp_mail() function isn’t sending any emails and displaying ‘0’ in Chrome ‘Network’ response
- How can I display a contact form for out of stock products in WooCommerce?
- How to get number of Affected rows from wordpress dbDelta() function
- Download any file after submitting a form [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Access WordPress data from external PHP application.
- How to create a custom post type that contains another custom post type?
- WP Query. Is there a maximum size?
- WP Plugins – Use includes to display page content
- Using window.onload with Ubermenu
- What is @Action in WordPress?
- How to include this jQuery File in wordpress?
- PHP Error When a plugin is active
- Inserting custom PHP script on homepage
- Include a php file from another plugin
- Add bcc to contact from on wordpress
- Getting taxonomy images to display on single-post with their terms
- wp-mail attachment is not sent for no reason?
- Custom shortcode for displaying user based on a role parameter
- wp_enqueue_scripts
- WordPress Console Application (ability to excecute a custom function via crontab only)
- How can I fetch data from another website to my wordpress website with mysql database
- Save user total active time after login in wordpress [closed]
- Get all the URLs of the pages that uses a specific shortcode
- Switch from wp-cron to a server cron job
- Calling a save function from a “submit” button
- Wp Debug Enabled True Notices and Warning
- Pagination shows Same posts
- Theme Functions run a function upon activation or preview
- Is this plugin safe to run?
- WP Subtitle Plugin Problem
- Custom Plugin scripts from admin working in frontend
- WooComerce Deposit: set specific shipping method and quantity based deposit amount
- Unexpected add action function in WP plugin
- How to get brand children with woocommerce brands
- Prevent WordPress from sending set-cookie http header
- get_post_meta shortcode returns empty field
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- How to add a prefix to a WordPress post preview url?
- i can not access the post in custom template of my wordpress plugin
- How to get a specific string from a url
- WordPress rewrite rule depend on meta values not ids
- location lock wordpress website
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- How to avoid the 403 Forbidden error in a WP Plugin with Ajax and PHP
- Problem with wordpress has_action() function
- Offering a freemium plugin (a free version + paid version)
- Why is my form going to frontend on html form submission present on the php files inside my custom plugin?
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- post id or permalink auto-incrementing number and reset everyday
- How To Use htaccess to Rewrite Link Structure for a Page that is Generated Programatcially
- WordPress logout appends cache/all/index.php to the site_url()
- Reverse count page view and show on other page
- Change (replace) word in metabox
- Limiting buddy press features based on membership level (PMPro)
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- Change pricing in Woocommerce based on Category and Product [closed]
- Register setting on plugin activation
- WordPress environment not loading properly
- How to remove a css class for any wordpress page
- Creating wordpress admin page panel [Theme Option]
- WordPress not displaying information on post sent from custom admin form
- How to replace native comment_count with Comments Evolved aggregate count
- Woocommerce: deleted single-product.php, everything still works. How is it possible?
- Is there any wordpress function to update a random post every 10 minutes?
- export high ress images to pdf
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Calling an custom field from theme option at the frontend
- custom url with custom post
- Saving an array to get_options
- Variable passed to each() is not an array
- Working on fixing wp-front-end-editor, encountering undefined index
- MySql Query for WordPress
- Some of my php is rendered only when logged as admin
- Shrinktheweb plugin problem
- Photos do not show on SEO platform built into a wordpress plugin
- Pulling sub-site content into specific pages
- Issue with custom plugin
- Showing author box on post detail page
- Help me with my first very basic plugin
- Getting Post Permalink Outside of Loop Not Working
- My wordpress website admin panel loads very slow, what can i do about that? [closed]
- PHP $_session is not work in wordpress
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- Undefined constant error in pluggable.php
- How to create post comparison in wordpress
- How to insert current “login” page to certain page?
- How to show random feed from DB and show content in my site
- Requires PHP version 5.3.0
- True or False: Is an Apache error or PHP error the same as a WordPress error?
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function