WordPress.org

Support

Support » Plugins and Hacks » Polylang » Is there a function to get translations by id or slug

Is there a function to get translations by id or slug

Viewing 1 replies (of 1 total)
  • There is no straight way, by you can do following:

    //Find the post id by it's slug
    $id = $wpdb->get_var("SELECT ID FROM $wpdb->post WHERE post_name = 'ny_jobs'");
    //Get post translation id
    $tr_id = pll_get_post($id,'fr')
    //Get the translation post object
    $post_object = get_post($tr_id)

Viewing 1 replies (of 1 total)
  • The topic ‘Is there a function to get translations by id or slug’ is closed to new replies.
Skip to toolbar