Incompatibility with WPML in Trash
Hello.
WordPress: 4.4.2 (multisite install)
Admin Columns Pro: 3.7.4
Admin Columns – Advanced Custom Fields add-on: 1.3.3
Advanced Custom Fields Pro: 5.3.4
WPML: 3.3.6
Custom Post Type UI: 1.2.4
Other plugins: Disabled
After deleting a CPT post, when loading the Trash list page (edit.php?post_status=trash), this error appears at “icl_translations” column, when trying to load the column value:
Fatal error: Call to a member function get_status_html() on a non-object in <hiding_my_path>\wp-content\plugins\sitepress-multilingual-cms\sitepress.class.php on line 4083
Going to “sitepress.class.php”, I’ve noticed that this error happens in “add_content_for_posts_management_column” function, because “$this->post_status_display” is not an object, and so it can not call to its supposed “get_status_html” function.
“$this->post_status_display” object should have been instantiated in “add_posts_management_column” function (at same file) but never gets to the instantiate object line because it enters into this “elseif”:
} elseif ( empty( $posts ) ) {
return $columns;
}
The fact is that when Admin Columns Pro plugin is disabled, the Trash list is working, and WPML doesn’t show the language column (“icl_translations” column).
I haven’t been able to guess why is this happening, from an Admin Column Pro (=ACP) point of view. It seems that ACP is, in some way, forcing to WPML to run the “add_posts_management_column / add_content_for_posts_management_column” functions in some early WordPress execution, when neither “$posts” nor “get_query_var( ‘post_status’ )” contains any value (in which case the error wouldn’t arises).
My solution it’s been modifiying the file: wp-content\plugins\admin-columns-pro\codepress-admin-columns\classes\storage_model.php
I’ve added this code to the function “add_headings”, after the “foreach”. Like this:
foreach ( $stored_columns as $column_name => $options ) {
if( $_GET['post_status'] == 'trash' && $column_name == 'icl_translations')
continue;
This has the effect of not trying to render the WPML column when we are in Trash. I think it would be much more appropiate, something like this:
foreach ( $stored_columns as $column_name => $options ) {
if( get_query_var( 'post_status' ) == 'trash' && $column_name == 'icl_translations')
continue;
But this function seems to run in an early WordPress status, and this is not possible.
Could you shed some light into this issue?
Thanks.
You must be logged in to reply to this topic.