Try changing the get_queried_object()->ID
to get_queried_object_id()
.
All the get queried object may not have a property name $ID
. So this get_queried_object_id
gives the $queried_object_id
property value, which gets set on instantiation of WP_Query
class. If the $queried_object_id
isn’t set then it’ll give you 0
.
Related Posts:
- Uncaught Error: Call to undefined function wp_generate_attachment_metadata() @ wp-cron
- When unit testing a plugin, does the plugin need to be in the wp-content/plugins directory of the WordPress tests install?
- How can I prevent a plugin from updating unless it’s minimum PHP version is met?
- Using require_once in a Plugin?
- Stackoverflow type of badge plugin giving warnings in WordPress 3.5
- Twillio How To Send SMS for Custom Post Type
- Plugin.php: PHP Notice: Undefined offset: 0 in
- Determining where fopen() is writing files when used from WordPress AJAX call [closed]
- How Restrict access to admin dashboard by specific static ip?
- How to get images from EDD post?
- Add multiple attributes to product from php
- How to install and activate a plugin via an external PHP script
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Add a plugin before main container
- Shortcode to generate and save password in a file
- I don’t understand how this parameter works..?
- problems with wordpress and php version 5.3.3-1
- WordPress Redirect Not Working – AJAX Callback Response Not Picked Up
- WordPress takes too much time (100 seconds) to load – Front end and back end
- Saving changes in wp_editor
- how to change the verification url of pie register plugin of wordpress?
- wordpress plugin is not activating from widget
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- wp_get_post_terms is difference obj model than the one in rest api response
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- WpDataTables – View Image Directory
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- Server configuration for WordPress – Do I need install PHP-SSH extensions for WordPress on Fedora28?
- WordPress shows error related to allow_url_fopen
- Delete mobile menu button [closed]
- How to replace WordPress Media Upload Window with user’s device window?
- Using color picker in plugin, does input attribute order matter?
- How can integrate zend module with wordpress admin dashbord [closed]
- WordPress custom taxonomy not showing
- My WordPress site when down after installing a plugin and now all I get is a simple white screen [closed]
- Adding media upload button to User Profile page (following a tutorial)
- Pass user role to javascript code inside body
- Integrating boxtal PHP library into a custom WordPress Plugin
- WordPress Stock Update Programatically
- UTF-32be error WordPress
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Customize Menu | Styling LESS/SCSS code formats
- ACF – How to set the menu order for the relationship field
- Custom search search does not work?
- same user role or copy the user role to be same as the other role
- Passing PHP Variables to AJAX Loaded Pages
- Social share buttons text shows up on post excerpts
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- Plugin Admin panel checkbox unchecked after submit
- Getting URL GET parameter with Code snippets and storing it in database?
- Send Array from JS to php file then insert it in wp database through a plugin
- Offer Download Links for Product Images
- save_post_product action not firing
- How to get the custom field value using SQL query
- How to list datas from database in a topic?
- WordPress fatal error from php protocol codes
- 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 use wp_insert_post and add og:custom tags?
- Changing wordpress/woocommerce notices default message to other languages (text)
- Why does my custom plugin only function correctly once per page?
- How to change “Read More” text?
- Using id to show item
- I can’t view the orders on the woocomerce dashboard with the brainblocks plugin
- WP Migrate DB Pro plugin cannot transfer Media files to remote server
- Woocommerce – Change variations output
- WordPress Plugin PHP Not Calling Function
- load plugin in code snippet
- Is admin section completely customizable in terms of styling?
- Run a Change Role Cron Job on WordPress via cPanel
- How to display variables from plugin?
- How to make the first letter of a post title uppercase, in a plugin?
- 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]
- How to change the product short description for each product with PHP?
- I want add repository theme folder
- Migrating custom php we wrote from functions.php into a site-specific plugin
- What is the correct entry point for capturing coverage data
- Adding featured image to post display widget
- plugins_loaded action is not working properly
- Creating a user ‘add custom field’ section
- How do I convince this button to do something when it is clicked?
- WordPress function to add text
- How to Set Limit with WordPress Get Bookmarks Shortcode
- TheCartPress plugin – Make every item in store unique
- Postal address auto-complete on profile page
- Insert dynamic content into posts
- avatar displays outside of targeted area
- ACF: Hide a div or template section when a custom field (in a field group) is empty
- 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
- Can anyone see a syntax error in this? [closed]
- Populate Woocommerce order notes with custom field value
- Woocommerce Product Add-ons – Auto-select first option
- Strict Standards: Non-static method in sidebar generator
- Warning: Undefined variable $admin
- public custom posts not showing in my wordpress plugin
- I want to allow certain file types on dokan upload files
- How to create different woocommerce single_product.php pages for each product? [closed]