Specific support for third party plugins are off topic, but your question can be answered in a general scope. get_the_ID()
will not work for this specific issue, what you need is an array of post ID’s that is currently being displayed on the page you are viewing.
The current array of posts that is being displayed on any given page is stored in the $posts
property of the main query or any custom instance of WP_Query
. It is from here that you would want to extract all the post ID’s from to pass to $args['post__not_in']
in your code in question.
You can try the following in your code above
global $wp_query;
$post_ids = wp_list_pluck( $wp_query->posts, 'ID' );
Then you can feed $post_ids
to $args['post__not_in']
$args['post__not_in'] = $post_ids;
You just need to pass the correct conditionals to target your specific pages
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- Plugin upgrading: Widget settings
- Simple rich text editor in Text widget?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- How to enable edit button in the theme’s customize UI?
- How can I make my custom shortcode work in a Custom HTML Widget?
- Need to create a Theme demo site that features multiple themes
- Disable Specific Widgets on Selected Pages of a WordPress Website?
- Adding a widget programmatically
- Delete Custom Dashboard Widgets
- Override dynamic_sidebar() in plugin?
- How to pass JavaScript variable to PHP in wordpress widget?
- Is dynamic forms/entries possible in Widget?
- How do I add a widget programmatically to a newly created site (WPMU) within a plugin?
- How To Add an Extra Field in All WordPress Available Widgets?
- How to place random widgets in the WordPress sidebar?
- Override Widget class in plugins with custom plugin
- Using the media uploader in a custom plugin
- Has anyone been able to get the aweber plugin to work
- How to create a widget or plugin to add custom content to my website?
- Pages with 2 Columns
- WordPress widget / plugin….fields not appearing in my widget
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Can I ignore caching of a plugin in W3 Total Cache? [closed]
- Why is the unrendered widget number `__i__` showing up in the JavaScript but not in the HTML?
- Custom Widget Creating PHP Exception When Placed In Its Own PHP File
- Remove Widgets in Dashboard
- register child class in another plugin
- Themes VS Plugins [duplicate]
- Changing widget options via the functions.php when there are no hooks
- Conditional Display of Links in Widgets
- How can I retrieve data within my widget
- How to Get Admin Settings for a widget when using the_widget() with custom widget
- How to unregister a widget from a child theme
- WordPress multiple widget in single plugin
- Created Widget Not Showing up on Admin Panel
- How do I register a stylesheet inside a WordPress widget?
- Setting up widgets in wordpress with a unique ID for the after_title argument
- How to exclude a widget from page 1 of a paginated post
- Detect if a plugin was included in a certain page
- How to get popular post from across a network?
- Are there plugins that interfere with the admin part of Rss widget?
- Flickr plugin that will display photos from multiple group pools? [closed]
- how can i limit the number of instances for my widget
- Dashboard Widget Form
- I need some direction on how to have a sidebar based on meta rather than page
- How can I reuse the WordPress search form for a custom plugin / widget?
- Admin Dashboard with Custom Tab for Client
- Multisite Widget/Content
- Passing $this->get_field_name() to javascript
- Is there plugin to show recent posts from one website in the widget area of another?
- Can I use a form in a dashboard widget?
- Ajax gives 400 error
- WordPress author details plugin/widget
- Missing argument 3 for wp_register_sidebar_widget()
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
- I wrote my plugin. How to display the result of the plugin’s function to sidebar (widget?)?
- WAMP to XAMPP WordPress transfer
- How to check if you are on widget.php page?
- I have no idea “How change font for elements in widget?”
- Widget for adding HTML markup to a page
- The plugin generated 3 characters of unexpected output during activation
- How to save additional user data as part of the registration process?
- Get post values of form created by widget in sidebar
- Theme’s default styles are overriding my plugin’s custom CSS
- Adding widgets to header and footer from plugin
- Archive – same title for the first two posts
- Rotate Widgets or Content Blocks every x sec/min
- Multi language site [closed]
- Template from scratch: Sidebars not showing widget
- How to get certain part from widget
- conditional tags for the output of a plugin
- What method should I use for a sidebar widget that reads latest posts?
- Widget redirecting to home page
- Plugin won’t activate, fatal error (widget class not found)
- WordPress plugin not eching popular posts
- pre-upload text and video for the future
- Trying to output a “Most visited blogs” list in wordpress multisite
- How to use template field in the Event Organiser plugin widget
- Last article Widget with text preview and more button
- Scrolling Ads? Live scrolling widget, not random on refresh
- How to develop an extension for a simple form post and post back? [closed]
- How to add homepage Widget?
- What are the downsides of using bootstrap in plugin development?
- Can’t edit Contact Us form on front page
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Sidebar Slideshow widget with text [closed]
- Is it possible to control content on different pages by checkboxing wich content is shown where on a wordpress theme page?
- Content expands beyond its column container [closed]
- Am having issues intergrating this api into my wordpress site, any help please?
- Issue with customizer and widget page
- Footer option is missing in Customiser
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Use custom Javascript for a custom Elementor Widget [closed]
- Why my widget is not visible in the WordPress theme Twenty Twenty-Three
- Hide attributes based on previous selection
- Custom Dynamic Tag in Elementor not showing image
- WordPress child theme widget customization – Eduma
- Elementor: Exclude product categories when using “Source: Current Query”