Try to replace
'post__in' => array($instance['postsToShow']),
with
'post__in' => explode(",", $instance['postsToShow']),
to feed the post__in
with an array.
Your current array looks like
array("123,456,789")
but should be like
array("123", "456", "789")
Related Posts:
- Post-ID in url differs from $post->ID
- Posts on Sidebar only
- How to display most popular posts from certain category in sidebar?
- Get page ID of page that is set as the posts page
- How to get post ID of the current page/post inside a widget?
- Are post ID’s reliable?
- Get current post id in functions.php
- get all posts ID from a category
- Display Random Author with Details in Sidebar
- Get the current post ID as a variable in Javascript
- Is post ID number always incremental n+
- $post>ID displays wrong post ID
- Getting post-thumbnails from another WP site
- Getting the Next and Previous Posts Titles in the Sidebar?
- widget should display post archive by year and on click also by month
- Are all ID’s used unique?
- Post X of Y in single.php / sidebar.php
- $post->ID displays wrong ID
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Which file displays the date archive?
- Showing random content / pictures from earlier posts in a sticky post?
- Get the post_id of a new post
- Get all posts by post_author
- get post id in while loops outputting page id
- Display all posts under child sub category in sidebar on post page?
- How can I display a specific user’s first published post?
- Undefined variable post_id in custom quick edit coloumn
- Load posts into sidebar and paginate via ajax?
- How to show post(excerpt) from specific category on wp page?
- How to show video from specific category on sidebar?
- WordPress menu that shows all posts in a certain category like w3schools
- How can I hide the sidebar from a specific post?
- Getting post id from wp_insert_post_data function?
- Does an article (post) id ever change?
- Displaying a widget only on long posts (over X characters)
- How to get the post’s parent ID?
- Can a page_id and a post_id be same?
- Is there a better, more efficient way to get the post id outside the loop?
- How can I display widget in a Page or Post?
- Getting current post ID in functions.php
- Buddypress activity id
- Sidebar links for different pages
- Show all posts in sidebar in single.php
- How blog page in WordPress works : blog page retrieve first post ID
- Get latest posts from WordPress site without header, menu and sidebar
- Why is my Blog Page ID == First Post ID?
- Ajax load more button in Recent posts widget
- I want to display custom text widgets for each post in the sidebar?
- current post with current author
- Is it possible to change post id for an already added menu item in WordPress?
- Get ALL post ID’s export list (Only id’s. Php or sql not important )
- How to get next post ID?
- Can wordpress post and sidebar remain visible after scroll?
- Search results posts_orderby and ID
- WordPress Sidebar menu for posts based on date – guidance needed
- remove post and categories/tags count from right now dashboard widget
- How to call widget by widget’s id?
- Retrieve post ID from “querying” URL
- How to get a post’s content? [closed]
- obtain the author id given the post id
- 2 dynamic sidebars registered, not showing up
- How to get ID of the page included with get_page()?
- How to I retrieve the ID from the Posts page?
- Sidebar show posts by current category also in single post
- Crazy Question – Updating Post ID
- Why I can not I use the variable outside my function?
- Widget that shows categories with posts numbers
- Getting Duplicate Posts on Home Page with Widget Added Between Posts
- retrieve the oldest post id
- Display current post position in Elementor Posts widget
- Custom posts listing widget always returns 1 extra result
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Load widget only on blog posts
- WP_Query custom field pass the post id
- Display a post via template
- Accessing Post ID Within Loop
- How do post IDs work in WordPress?
- Are post, page and category IDs unique to each other?
- Adding a meta box to determine the sidebar [closed]
- The loop starting at a certain ID
- linking to post outside the loop
- Sidebar on single.php not showing up
- Get a post’s ID
- Making posts permalinks consistent numbers
- Sidebar limiting to 10 posts?
- Getting post and attached image from subdomain
- Conditionally exclude post from specific category on home page sidebar?
- How to get post id of last approved comment?
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- Show 10 latest posts only from users with contributors role
- Display most recent posts in category with Twenty Ten theme widget
- How to show multiple posts thumbnail, title and date in widget
- Move position in post list for a custom checkbox column
- Add checkbox in admin post list – show checked post in widget
- Create a List of Widgets, where each widget holds three attributes
- Custom Fields – How to get the list of a specific active widget each time it rendered
- Get post slug and match with menu item slug to change css
- WordPress Post ids big increment
- How can I create a ‘sub-blog’ which has its own sidebar on individual posts?
- How do i bring out post category name in my widget?