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:
- Update (a function) post’s featured image as soon as $image_url changes
- get/show Last ID
- Custom SportsPress list
- Migrating custom php we wrote from functions.php into a site-specific plugin
- What is the correct entry point for capturing coverage data
- Nested DIV’s across functions in PHP, do not seem to work
- Register setting on plugin activation
- Help with customising love it plugin (use within foreach)
- Plugin communication between sites that use it?
- Passing ajax variable to more than one wordpress plugin function
- how change my menu on submenu
- Plugin debugging with errors in activation routine
- My ajax request don´t work and return 0
- Number format in thousands on highcharts in wpdatatable plugin
- WordPress environment not loading properly
- Problem with conditional woocommerce custom checkout field
- How to remove a css class for any wordpress page
- How do I change tab url
- Form tries to download a file on submit
- Creating wordpress admin page panel [Theme Option]
- Populate select option with JSON file
- How to insert image into the Settings Page of a Plugin?
- Adding link for logged in user? [closed]
- WordPress not displaying information on post sent from custom admin form
- GET web api method from a WordPress PHP script
- Add class as plugin for other plugins
- Embed Javascript code to registered users only
- How can I remove this sidebar from my Search Results page?
- ACF Repeater Field Question [closed]
- Creating new option (add_option) from AJAX – Settings API
- Use WP_Query for custom post type but result get empty
- Social sharing plugin directing to blank page after post sharing
- Same Title on two different post type with single custom taxonomy
- insert multiple entries in database using a loop issue
- Query Shortcode from a multisite to appear on a different site?
- Every time I use wp_get_current_user() my plugin breaks
- How to order users alphabetically by name? in plugin UPME
- How to change text in a page by utilizing a custom user id?
- How to echo a plugin’s function into a template?
- How to replace native comment_count with Comments Evolved aggregate count
- Paginated Comments “reply” does not work!
- Displaying friend’s posts only
- Adding link on title its in description but not in title see screenshots attached
- Theme editor removes backslashes
- Find all strings between an enclosing shortcode
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- How to create a dashboard for logged-in users with custom functionality? [closed]
- using href when creating wordpress plugin calls empty page instead of php file
- Need help integrating plugin into theme
- How to allow customers to input a text as a product variation *and* charge per character?
- Retrieve data from multiple WordPress sites using PHP script
- resizes images on the fly
- Things that saved lose when logout
- plugins_loaded action is not working properly
- Creating a user ‘add custom field’ section
- How can I insert a record into a custom table from my custom form in my custom admin page?
- Trending Tags based on post views
- get_option return incorrect values
- I created a custom form in HTML/CSS and now I need it to submit … should I create custom PHP or is there a plugin I can use?
- It possible to implement an adhoc php web application with wordpress?
- Create csv file in plugin
- Woocommerce: deleted single-product.php, everything still works. How is it possible?
- Cannot access variables within a widget
- Is there any wordpress function to update a random post every 10 minutes?
- Editing Global Variables from Inside Functions
- export high ress images to pdf
- Media Playlist Plugin
- How to speed up installing plugins and upgrading WordPress
- How to copy data from user profile page (profile.php) to theme customizer
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Calling an custom field from theme option at the frontend
- How to save information related to post in database?
- Changes required to make new plugin from existing
- Save selectlist value (taxonomy) in wp:wp_set_object_terms
- Page doesn’t load
- Plugin Hook: Get posts
- AJAX doesn’t pass variables to the php function in the plugin
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- What is the process for reimplementing a back up WordPress?
- Saving custom form fields
- Posting code inside the post instead of in the template file using shortcode
- W3 Total Cache Can’t Really Detect Things
- How to add php stylesheet to admin section instead of admin_head hook
- How do I convince this button to do something when it is clicked?
- Showpost and last
- custom url with custom post
- WordPress function to add text
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- display user input using ajax in wordpress
- WordPress Background Audio – Continous AutoPlay
- Variable passed to each() is not an array
- Metabox Data not saving
- How to Set Limit with WordPress Get Bookmarks Shortcode
- Plugin Breaking WordPress Login
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- How can you call to data in google sheet based on ID number?
- Elementor: Exclude product categories when using “Source: Current Query”
- How to resolve Multisite Speed issues