Skip to content

Commit 888ae64

Browse files
release: fixes
- Fixed compatibility issue with some themes and plugins #933
2 parents fe73598 + b27066c commit 888ae64

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

classes/Visualizer/Module.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
6767
$this->_addFilter( Visualizer_Plugin::FILTER_UNDO_REVISIONS, 'undoRevisions', 10, 2 );
6868
$this->_addFilter( Visualizer_Plugin::FILTER_HANDLE_REVISIONS, 'handleExistingRevisions', 10, 2 );
6969
$this->_addFilter( Visualizer_Plugin::FILTER_GET_CHART_DATA_AS, 'getDataAs', 10, 3 );
70-
$this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 );
70+
$this->_addAction( 'pre_get_posts', 'PreGetPosts' );
7171
register_shutdown_function( array($this, 'onShutdown') );
7272

7373
}
@@ -793,6 +793,21 @@ public function _getImage( $chart = null ) {
793793
);
794794
}
795795

796+
/**
797+
* Filter chart title if visualizer post type.
798+
*
799+
* @param object $query WP Query object.
800+
* @return void
801+
*/
802+
public function PreGetPosts( $query ) {
803+
if ( ! $query->is_main_query() ) {
804+
$post_type = $query->get( 'post_type' );
805+
if ( 'visualizer' === $post_type ) {
806+
$this->_addFilter( Visualizer_Plugin::FILTER_CHART_TITLE, 'filterChartTitle', 10, 2 );
807+
}
808+
}
809+
}
810+
796811
/**
797812
* Filter chart title.
798813
*

0 commit comments

Comments
 (0)