Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Is there a public function to get post language by its ID ? #321

Open
rksh1997 opened this issue Feb 5, 2019 · 2 comments
Open

Is there a public function to get post language by its ID ? #321

rksh1997 opened this issue Feb 5, 2019 · 2 comments

Comments

@rksh1997
Copy link

rksh1997 commented Feb 5, 2019

Version Information

  • MultilingualPress: 3

Is there any function that I can pass it the post ID and get its language ? something like this:
mlp_get_post_language( $post->ID ) // en

I couldn't find it in the docs.

@widoz
Copy link
Member

widoz commented Feb 5, 2019

Hi @FrankenSteinxD Languages are related to sites and not posts, I think to get the blog language from post, you need to create a function that get the blog ID from the post object/id value.
I'm not sure if is there a function for that in WordPress I looked for it but I haven't found and probably that means you have to write a query to retrieve it.

But I think you are talking about mlp2 am I right?

@joshuadavidnelson
Copy link

I know this is way late to the game, but found this topic while researching this myself.

For version 3, I think you want:

\Inpsyde\MultilingualPress\translationIds( $post_id );

See /src/inc/api.php

Should return an array of content ids.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants