Open lasagnapuppy opened 5 years ago
Hey @lasagnapuppy, the third parameter you are passing to the_favorites_button
is not used to designate post type.
It's used to pass along a site_id
, not target post type. If i'm not mistaken, by default the_favorites_button
should support custom post types.
Let me know if you're still experiencing this issue.
@GFargo I have a related issue where I can't get favourites to work with a custom post type. It works fine for standard posts but with custom post types I get:
The favorite was successfully saved. favorites
Object { status: "error", message: "Invalid post." }
Simply using the below, where $id is my post, I checked the HTML and it is inserting the correct data. (for example data-postid="175") but it won't work.
<?php the_favorites_button($id,NULL);?>
If I use a post ID that is not a custom post type, it works.
EDIT: SOLVED! In the favorites settings I didn't enable the custom post type.
I am receiving this message on the console. Wordpress 4.9.8. So far no problems with any other plugin. Site is in a vagrant box, while develping. Plugin version 2.2.0. I am trying to apply this to a custom post type. Here is how i am calling the function:
<?php the_favorites_button(get_the_ID(), NULL, "games"); ?>
EDIT: The error i am receiving is:
The favorite was successfully saved. favorites.js:635:6 Object { status: "error", message: "The nonce could not be verified." }
What can be the problem? Thanks in advance.