Open cliffordp opened 10 years ago
Ping @xyu
jetpack_relatedposts_filter_thumbnail_size
, jetpack_relatedposts_filter_post_type
, jetpack_relatedposts_filter_date_range
. jetpack_relatedposts_filter_has_terms
filters)the_content
filter when the shortcode is used very quick example.@kraftbj I suggested to @cliffordp that post types might be indexed if they support comments. It turns out this is not the case.
@enejb Gotcha. CPTs are generally included if they're public, I believe. @xyu can confirm since this is his wheelhouse.
For the 2nd point, yes, @kraftbj, although I added the idea for include_post_ids (i.e. forcing to be included)... basically allowing shortcode attributes for those filters.
Thanks for considering this list and for the demo link that shows that item works.
@kraftbj @enejb by default we only index the standard post and page post types. However public CPTs can be whitelisted using the rest_api_allowed_post_types
filter.
@enejb provided this code to me, which didn't result in indexing my 'real-estate-answers' custom post type:
function jetpack_sync_real_estate_answers($post_types){
$post_types[] = 'real-estate-answers';
return $post_types;
}
add_filter( 'rest_api_allowed_post_types', 'jetpack_sync_real_estate_answers');
Should that code be working?
@cliffordp Could you try to reindex, by going to the Debug menu in Jetpack and clicking on the Reindex button? You can access the debug menu by going to the Jetpack menu in your dashboard, and clicking on the "Debug" link at the bottom of the page.
Yes, I did that after adding the above code. We tried several different ways. Is the code above correct? (i.e. Add code, Reindex, Use API console to check by post ID)
@cliffordp Apologies for the inconvenience but we are currently upgrading our internal search infrastructure in order to provide even faster and better searching and have turned off indexing / loading new content while this is going on.
We are aiming for later today or tomorrow to start indexing again, if you provide @enejb or I your site's URL we can prioritize it so that it's one of the first to be reindexed.
@xyu, @enejb and I have been playing with 'real-estate-answers' cpt for http://endzonerealty.com/ for over a week now so anything yesterday or today wouldn't have affected this. That's why I was asking for verification if the code was the correct way to add my cpt. Thanks.
@cliffordp your code is indeed correct and I do see that the 'real-estate-answers' CPT posts are in our system however they were not indexed into our search infrastructure but they should be indexed at this point.
I didn't intend to turn this into a "it's not working" back-and-forth topic, but it's not working for me. In the console, /sites/43838058/posts/13851/related returns "error Bad Request. message query failed." However, if I understood you correctly, you said it should be indexed at this point. I tried it and got this error then told it to re-index posts again. Once it said it re-indexed, it still gave the error in console.
Hi. Just checking back to see if there's any way to use Related Posts on my 'real-estate-answers' custom post type for endzonerealty.com
tyvm
Hi Cliff, Turns out this is a bit more tricky then we though. We are still working on this and will let you know when it is ready. The changes required have to be done in such away so that it doesn't break backwards compatibility or expose private data.
Check out https://github.com/xyu/jetpack/tree/jsonapi-allow-public-cpts is the branch where the work is taking place.
Excellent. Thanks for the follow up. I'll be eagerly awaiting the functionality, as well as other enhancements (my suggestions in this issue's initial comment). Thank you all so much!
@cliffordp is this working for you yet? I was curious as to this functionality, as well, and a Google search led me here.
Ya know, I've definitely seen it working on some posts and thought "don't know what changed, but great!" But just now checked a few and didn't see it working. Example CPT post where I'd like to see related posts displayed: http://endzonerealty.com/real-estate-answers/need-flood-insurance/
I have [jetpack-related-posts]
in the Views content template and in the Views Settings "Third-party shortcode arguments" (http://wp-types.com/documentation/user-guides/shortcodes-within-shortcodes/) and, like I said, I definitely have seen it working and referring to other posts within the same CPT so... short answer is "maybe a little" ;)
@cliffordp Thanks for getting back so quick! That's kind of a bummer. I was hoping to offshore related posts to jetpack, but hopefully it won't be so finicky soon.
@cliffordp @mfgmk In order to get CPTs to work with related posts they must be explicitly whitelisted see here in order for them to be synced to Automattic. (Once it's been whitelisted go into the Jetpack debug page and trigger a bulk resync to force a sync.)
Then to get related posts to also include CPTs in results you can filter jetpack_relatedposts_filter_post_type akin to getting pages to show up in results.
Let me know if that helps.
@xyu -- would you mind following up on this and either closing or updating?
Hi, I've just found this issue, and I'm experiencing the same problem with my site.
The issue seems to be that there's no way to trigger Jetpack_RelatedPosts to index posts other than the defaults ( 'post', 'page' ).
The Related Posts module on load calls Jetpack_Sync::sync_posts( __FILE__ );
. Unless Jetpack_Sync::sync_posts is passed a second argument to override the default values, it will only sync posts and pages, with publish status.
Do you have any thoughts about making this option filterable, so that we can index custom post types here?
we can index custom post types here
Could you try the following, then head to the Jetpack menu, scroll down to the bottom of the page, click on the Debug link, and click on the Reindex button?
If that doesn't help, could you send us an email with more details about your site, so we can take a closer look?
Thanks!
Could you try the following
Thanks. I have all post types enabled in rest_api, and hitting the post endpoints for all custom post types works fine:
$ http get https://public-api.wordpress.com/rest/v1/sites/107221514/posts/250296
HTTP/1.1 200 OK
Cache-Control: no-cache, must-revalidate, max-age=0
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json
Date: Thu, 17 Mar 2016 16:13:31 GMT
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Pragma: no-cache
Server: nginx
Strict-Transport-Security: max-age=15552000
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Prefork: 1
X-ac: 2.mia _dca
X-hacker: Oh, Awesome: Opossum
{
"ID": 250296,
[...]
but trying to hit the related endpoint for anything but posts returns this:
$ http post https://public-api.wordpress.com/rest/v1/sites/107221514/posts/250296/related/ size=5
HTTP/1.1 400 Bad Request
Access-Control-Allow-Origin: *
Cache-Control: no-cache, must-revalidate, max-age=0
Connection: keep-alive
Content-Type: application/json
Date: Thu, 17 Mar 2016 16:15:14 GMT
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Pragma: no-cache
Server: nginx
Strict-Transport-Security: max-age=15552000
Transfer-Encoding: chunked
X-Prefork: 1
X-ac: 2.mia _dca
X-hacker: Oh, Awesome: Opossum
{
"error": "Bad Request",
"message": "Post does not exist"
}
but I do see that my index status is not complete, so I'll wait for that to finish, and then open a support request if I'm still seeing this problem. It could well just be an indexing problem. Thanks!
This issue has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
This issue has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
This issue has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.
I hope some or all of these ideas can be implemented into the Jetpack Related Posts module. tyvm for it.