• Per the title, frontend-auto-translate.php:160 needs to handle the case where post_type is an array of post types. As of WP4.8.2 this generates a _doing_it_wrong.

    • This topic was modified 6 years, 6 months ago by jcracknell.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chouby

    (@chouby)

    Thanks, I would like to look a this. Could you point me to this new _doing_it_wrong?

    Thread Starter jcracknell

    (@jcracknell)

    If you call get_posts(['post_type' => ['post','page']]), you should get a _doing_it_wrong originating from line 160 of frontend-auto-translate.php. This should probably be refactored to always convert post_type to an array with an in (...) query.

    Per the documentation, post_type can be a string or an array of post types:
    https://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters

    XDebug gives me this (partial) backtrace:

    26	1.9941	35546616	PLL_Frontend_Auto_Translate->pre_get_posts( )	.../class-wp-hook.php:298
    27	1.9942	35546712	wpdb->prepare( )	.../frontend-auto-translate.php:160
    28	1.9942	35547432	_doing_it_wrong( )	.../wp-db.php:1310
    29	1.9942	35548136	trigger_error ( )	.../functions.php:4139
    • This reply was modified 6 years, 6 months ago by jcracknell.
    Plugin Author Chouby

    (@chouby)

    I see. The _doing_it_wrong is added by WP 4.8.2 but the bug is not related to WP 4.8.2. I will fix that. Thanks for pointing this 🙂

    Plugin Author Chouby

    (@chouby)

    This is now fixed in the development branch: https://github.com/polylang/polylang/archive/master.zip

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘frontend-auto-translate.php:160 does not handle array-valued post_type’ is closed to new replies.