[Plugin: Polylang] Problems with custom post type archive titles
I’m having some problems with custom post type archive title.
In template functions.php I have registered custom post type ‘ily_events’ with archive slug ‘events’. There are two languages defined (Latvian and English) with few event posts in each language published.
polylang settings dump:
Array ( [browser] => 1 [rewrite] => 1 [hide_default] => 0 [force_lang] => 1 [version] => 0.7.2 [default_lang] => lv )
gives two PHP notices:
Undefined property: stdClass::$labels includes/general-template.php on line 665
Trying to get property of non-object in [...]/wp-includes/general-template.php on line 665
It throws out in wp_title() and after debugging I found that incorrect object is returned from
post_type_archive_title()in /wp-includes/general-template.php on line 664.
var_dump($post_type_obj);on next line shows corresponding language object:
object(stdClass) public 'term_id' => string '6' (length=1) public 'name' => string 'English' (length=7) public 'slug' => string 'en' (length=2) public 'term_group' => string '1' (length=1) public 'term_taxonomy_id' => string '6' (length=1) public 'taxonomy' => string 'language' (length=8) public 'description' => string 'en_US' (length=5) public 'parent' => string '0' (length=1) public 'count' => string '5' (length=1)
but instead it should return a post object. Other archive titles are generated correctly.
Maybe polylang is missing some filters required to return correct object or it is messing up correct values.
Also while debugging I got these notices on saving post with tags:
PHP Notice: Trying to get property of non-object in [...]/wp-content/plugins/polylang/include/base.php on line 133 PHP Notice: Undefined variable: newterms in [...]/wp-content/plugins/polylang/include/admin-filters.php on line 384
don’t know about first yet but second one is trivial – unset variable.
corrected the latter by adding
$newterms = array();on line 380
I’ll try to debug further and post here.
- The topic ‘[Plugin: Polylang] Problems with custom post type archive titles’ is closed to new replies.