File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ public function __construct( Visualizer_Plugin $plugin ) {
67
67
$ this ->_addFilter ( Visualizer_Plugin::FILTER_UNDO_REVISIONS , 'undoRevisions ' , 10 , 2 );
68
68
$ this ->_addFilter ( Visualizer_Plugin::FILTER_HANDLE_REVISIONS , 'handleExistingRevisions ' , 10 , 2 );
69
69
$ 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 ' );
71
71
register_shutdown_function ( array ($ this , 'onShutdown ' ) );
72
72
73
73
}
@@ -793,6 +793,21 @@ public function _getImage( $chart = null ) {
793
793
);
794
794
}
795
795
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
+
796
811
/**
797
812
* Filter chart title.
798
813
*
You can’t perform that action at this time.
0 commit comments