You can use get_the_category()
It will return an array of category IDs belonging to the current post.
$post_cats= array();
$categories = get_the_category();
foreach($categories as $cat) :
array_push($post_cats, $cat->cat_id);
endforeach;
Then the $post_cats array will have a list of all the ids.
Related Posts:
- How to include PHP files in plugins the correct way
- Prevent network activation of plugin
- How are bulk actions handled in custom list table classes?
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- Get list of scripts / styles and show file which enqueued them
- WordPress updates defined vs add_filter?
- Creating Settings Page with dropdowns for Plugin
- How can I track active users of my plugin? and why doesn’t WordPress.Org offer this?
- Empty POST data on server on AJAX request using Angular $http
- Custom Nav Menu items default to ‘menu-item-type’ => ‘custom’. How to make a “page” menu item?
- Custom attachments uploader code. Almost there!
- $wpdb->insert is changing a value
- What are the default WordPress password requirements?
- Can I get all options using the option group id? [closed]
- Actions or filters fired when data is saved in a custom table
- Implementing namespaces in plugin template
- How to get current page name in my wordpress plugin
- Conditional add_filter?
- Use register_taxonomy() in register_activation_hook()
- The plugin generated 80 characters of unexpected output!
- How to update/auto-update my private plugin? [duplicate]
- How to use WP default post list tables in a plugin?
- Calling apply_filters on non-documented hooks
- What’s the Right Way to get and save remote data for a Gutenberg block?
- Commit changes to WordPress Plugin SVN with TortoiseSVN
- add_shortcode is not working [duplicate]
- Filter, or any way to dynamically change theme screenshot image?
- How to get the post content after WordPress post processing?
- Show add_meta_box by selecting a specific category
- Retrieve contents/page names of various pages for use in a plugin
- How do I dynamically render an InnerBlock inside a dynamic block?
- Does WordPress run install/uninstall functions on plugin upgrade?
- Slow WP_query due to nested wp_query. Need Suggestions
- How to modify product page for Jigoshop
- How to filter the_content() & include content from template
- Is @wordpress/env locked to node v14 or can I also use node v16?
- ResizableBox with RangeControl not working
- WordPress Custom URL
- Asynchronously render shortcodes in TinyMCE visual editor
- what is the standard ulr for wordpress plugin development?
- wp_mail() headers multipart/alternative
- Create a custom capability to allow an ‘Editor’ to edit only ‘Subscriber’ users
- global $current_user not current user
- What is the proper way to get logged in user id in a plugin?
- WordPress Plugin Activate / Deactive Failing
- How can I add a simple custom field to my plugin?
- Ajax is not working in a loop
- Custom Plugin – CSS works, JS doesn’t
- Inserted double quote when prepending to the_content
- unable to wp_enqueue_script(‘suggest’);
- Plugin development – loading Javascript and Flash
- update_post_meta doesnt update template
- Update variable value via add_filter
- Setting global block attribute value
- Plugin custom post template; without overriding all posts
- Run uninstall.php if a checkbox is checked from settings page
- Gravity Forms Anchor only on Front Page?
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- How to set a header in wp_safe_remote_get()?
- Multiple page plugin settings
- sanitizing/escaping plugin options
- how to get the top 10 popular blogs
- can’t access some WordPress function from my plugin
- script seem not load with use wp_enqueue_script
- Impossible to declare box-shadow with wp.customize?
- Do I lose translations when I change my Text domain for my plugin on wp.org?
- Get search result count in plugin
- Transform internationalized plugin into internationalized mu-plugin?
- Override woocommerce loop-start.php from theme using plugin?
- Get value of custom checkbox from Gutenberg sidebar in plugin
- Rate limiting ajax requests in WordPress
- How to filter an action inside class in MemberPress plugin?
- XMLHttpRequest to open PHP file responds with Missing Page
- Pre-populated WooCommerce checkout fields: dropdown fields issue
- jQuery dependent script ignores $in_footer bool and doesn’t work in header
- Hiding class namespace from plugin’s extensions
- Relational / Associate tables using native WordPress functionality
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- WordPress Search Form with Keyword Suggestion
- Pull commentdata for pre_comment_on_post from comment_post_ID
- Woo-commerce: Adding additional page sections using a child theme
- Get the post ID only off single page
- How to get html tag ids from template?
- Bootstrap collapse in custom WordPress widget
- Page reload occurs before request finishes
- PHP Fatal error when using plugin_basename
- How to Rewrite WordPress URL for a Plugin
- append code after the_content not working
- What does $_REQUEST[‘redirect_to’] do?
- How to Prove Ownership of plugin [closed]
- how can a plugin return an error message on activation?
- Declaration of mandoe_menu_walker::start_el(&$output, $item, $depth, $args) must be compatible with Walker::start_el(…)
- Reading the inside of
- WordPress, GIT, Renamed Plugin Dir + files – Working Code now Broken [closed]
- Call API on post save/update and show the result in admin area
- Is there any other ways to replicating changes on live from staging without pushing from git
- upload image to wordpress media library failed for custom post type
- Fetch Custom Woocomerce filed data and check the data avialble in Wp-user table as nicname or username using function.php
- How to get locale within WP REST Request?
- How to add extra EXIF data when images are uploaded?