Run plugins only on certain pages

I want to load content from another table into wp_posts and then show it as a normal page. What solution do you recommend.

If that’s your goal, then use shortcodes!

For example:

// PHP code
add_shortcode( 'footag', 'wpdocs_footag_func' );
function wpdocs_footag_func( $atts ) {
    return "foo = ".$atts['foo'];
}

Then in your content:

[footag foo=”bar”]

This prints foo = bar on the frontend

The [footag] will get replaced by what your shortcode function returns, and it’ll happen when the page is generated. You can pass attributes to it too

Read more about add_shortcode and check the examples at the official docs here:

https://developer.wordpress.org/reference/functions/add_shortcode/