add_action(‘the_content’, ‘my_plugin_content’) is null
Question
I am creating in personal plugin where I recover data from a personal table.
Con add_action(‘the_content’, ‘my_plugin_content’); posso far vedere il contenuto in una pagina.
I would like to save the content in wp_posts with add_filter (‘save_post’, ‘my_plugin_content’), but the content is empty.
function my_plugin_content($content){
$current_page = $wp->request;
include_once(plugin_dir_path( __FILE__ ).'views/view.php');
$obj = new Loader;
$content.=$obj->controller($current_page);
$my_post = array();
$my_post['ID'] = $post->ID;
$my_post['post_content']=$cont;
}
in another file I run the data recovery query that I refer to the file loader that loads the views
File loader
public function view($view, array $dati){
require(DIR_PLUGIN.'views/'.$view.'_v.php');
}
File view
<?php foreach($dati as $p){ echo '<p><strong>'.$p->NAME.'</strong></p>; }?>
0
database, plugins, save-post
3 years
2020-04-01T16:51:16-05:00
2020-04-01T16:51:16-05:00 0 Answers
92 views
0
Leave an answer