BUG – Addon: Unique Posts

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

Status: not resolved
Viewing 27 reply threads
  • Author
    Posts
    • #18302

      marcorroma
      Member

      Hi, I have a bug with the Addon: Unique Posts plugin.
      I published a sticky post with multiple categories selected.
      My homepage and categories are made with WPbakery.
      Both on the homepage and in the categories, I have a post block at the top with only sticky posts (I set only the categories excluded from that post block).
      The sticky post is displayed correctly on the homepage and in categories if I log in, it is not displayed on the homepage and categories if I view the page in incognito mode.
      I cleared my cache plugin cache several times, cleared the browser cache. Nothing.
      I don’t see the post.
      I tried to disable the Addon: Unique Posts plugin, clear the cache again, and now it also appears in incognito mode.
      Can you solve this problem?
      It only seems to happen if multiple categories are selected with a sticky post, and a post block only for sticky posts.
      I await your support.
      Thanks

    • #18308

      marcorroma
      Member

      I have the same problem with other post block wp too.
      Screenshots:
      Homepage with login:
      i.ibb.co/cc46r1h/login.png

      Homepage not login(incognito):
      i.ibb.co/whyPJ0W/incognitio.png

      Section with login:
      i.ibb.co/MRRK807/section-login.png

      Section not login:
      i.ibb.co/N7QKgBq/section-incognito.png

    • #18309

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18315

      marcorroma
      Member

      If you disable, then activate the Unique posts plugin, the problem is solved momentarily.
      It is complicated for me to do it every time, many posts are published on my site.
      How can you solve it?

    • #18362

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18367

      marcorroma
      Member

      Not resolved. The problem is still there.
      In incognito mode, not logged, newer posts are displayed. Logged in no new posts.
      Check out these screenshots:
      Not logged:
      i.ibb.co/wNNLrGV/screencapture-corriereromagna-it-2020-05-10-16-15-39.png

      logged in:
      i.ibb.co/41FLM4M/screencapture-corriereromagna-it-2020-05-10-16-16-01.png

    • #18693

      marcorroma
      Member

      IMPORTANT PROBLEM
      Hi Jacob, the categories are not updated correctly. I also use post blocks for categories.
      I made you some videos with the problem and the solution (by deactivating the plugin). But this is not a definitive solution for me, because I would have many duplicate posts on the homepage and on the categories.

      I’ll send you the videos in the next reply:

    • #18697

      marcorroma
      Member
      This reply has been marked as private.
    • #18699

      marcorroma
      Member

      My fellow journalists are very angry that their articles are not displayed on the homepage and in the categories.
      So now I have disabled the “wpthms – Newsbeat – Addon: Unique Posts” plugin.
      But now some posts are displayed 2-3 times on the same page. This is a big problem for me.
      Can you devote some of your work to me and fix this?
      It is really important for me and my work.
      I hope you will understand …
      Thanks Jacob

    • #18700

      Jacob
      Staff
      This reply has been marked as private.
    • #18701

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18702

      marcorroma
      Member
      This reply has been marked as private.
    • #18703

      marcorroma
      Member

      I use post blocks for categories because I can customize the category as I want. I can manage the category like the homepage. It is indispensable for me. Is it possible to “adapt” your plugin also for my categories created with post blocks? (yours is a great posts block plugin, I recommend you use it for categories as well, for your next themes/updates).

    • #18704

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18706

      marcorroma
      Member

      hello, wouldn’t it be better to activate this function for each category?
      anyway your code prints me this error, screenshot:
      i.ibb.co/370nXGR/IMG-20200808-015545.jpg

    • #18707

      Jacob
      Staff
      This reply has been marked as private.
    • #18710

      marcorroma
      Member
      This reply has been marked as private.
    • #18711

      marcorroma
      Member
      This reply has been marked as private.
    • #18719

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18720

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18725

      marcorroma
      Member

      Hi Jacob, is it possible to create function that work in categories? How your plugin works with the homepage to avoid duplicate posts.

      I don’t know how to create a function with pre_get_posts hook. If you can help me… Please.

    • #18729

      marcorroma
      Member

      This code solves the problem but only on the homepage, how can I also use it in the categories?

      add_filter(‘post_link’, ‘cr_search_displayed_posts’);
      add_action(‘pre_get_posts’,’cr_remove_already_displayed_posts’);
      
      $displayed_posts = [];
      
      function cr_search_displayed_posts($url) {
      global $displayed_posts;
      $displayed_posts[] = get_the_ID();
      return $url; // don’t mess with the url
      }
      
      function cr_remove_already_displayed_posts($query) {
      global $displayed_posts;
      $query->set(‘post__not_in’, $displayed_posts);
      }
    • #18730

      marcorroma
      Member

      PS. I have the post blocks with “load more” and “infinite scroll” display and I display duplicate posts, With the code above.

    • #18731

      marcorroma
      Member

      UPDATE. I put the above code in header.php, like so:

      	<?php do_action( 'newsbeat__before_content_wrapper' );
      	
      	// no duplicate posts
      	add_filter('post_link', 'cr_search_displayed_posts');
      	add_action('pre_get_posts','cr_remove_already_displayed_posts');
      
      	$displayed_posts = [];
      
      	function cr_search_displayed_posts($url) {
      	global $displayed_posts;
      	$displayed_posts[] = get_the_ID();
      	return $url; // don’t mess with the url
      	}
      
      	function cr_remove_already_displayed_posts($query) {
      	global $displayed_posts;
      	$query->set('post__not_in', $displayed_posts);
      	}
      	
      	?>

      this way it works on the homepage and in the categories. I only have the problem of navigation. I use “load more” and “scroll infinity”, can you help me Jacob please?

    • #18732

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #18736

      marcorroma
      Member

      Would you give me some help to find the solution?
      It is important for me

    • #18747

      marcorroma
      Member

      I’m waiting for your help, please.

    • #18765

      marcorroma
      Member

      @jacob are you okay?

Viewing 27 reply threads
  • You must be logged in to reply to this topic.

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

© Copyright 2020 by wpthms.com. All Rights Reserved.