I need to use my private plugin solely in some pages.
If I take away the add_action perform (‘the_content’, ‘my_plugin_content’); the plugin doesn’t present me the content material of the opposite pages that aren’t in in_array ();
perform my_plugin_content($content material){
world $put up; world $wp; world $wpdb;
$web page =array('page1', 'page2','page3');
$current_page = $wp->request;
if(in_array($current_page, $web page))
{
$old_content=$post->post_content;
$sql = "UPDATE wp_posts SET post_content = '' WHERE ID = $post->ID";
$wpdb->get_results($sql);
include_once(plugin_dir_path( __FILE__ ).'loaders/loaders.php');
$obj = new Loader;
$content material.=$obj->controller($current_page);
$my_post = array();
$my_post['ID'] = $post->ID;
$my_post['post_content']=$content material;
wp_update_post($my_post);
}
}
add_action('the_content', 'my_plugin_content');