WordPress substitute the_content other page
Question
I’m doing a plugin that display another page content for some customer personalization.
With this code:
add_action('template_redirect','hooker');
function hooker(){
global $post;
global $wp_query;
$redirect_post = get_post_meta($post->ID, 'redirect_url_customization', true);
if(!empty($redirect_post)){
$post = get_page($redirect_post);
$content = apply_filters('the_content', $post->post_content);
echo $content;
}else{
}
}
But the problem is that is showed original page and personalized page. Is it possible to stop to execute the_content()?
Thanks,
Jacopo
0
plugins
4 years
2020-03-04T15:51:14-05:00
2020-03-04T15:51:14-05:00 0 Answers
75 views
0
Leave an answer