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”] … Read more

Trouble with CPT Child 404

You can’t have both a page and a Custom Post type with the same slug, in your case videos. See: https://core.trac.wordpress.org/ticket/38599 for a ticket recommending this be changed in core. A few solutions: Change either the page or the post type to video instead of video Follow the Template Hierarchy and create a archive-videos.php with … Read more

How to redirect a page to another?

Try the following at the top of your .htaccess file, before the existing WordPress directives: RewriteRule ^test/ /info/ [R=302,L] The pattern ^test/ matches all URLs that start /test/. Note that the URL-path matched by the RewriteRule pattern (first argument) does not start with a slash (when used in .htaccess). If this is intended to be … Read more

How to get custom page template being edited in gutenberg editor

You can use this code once set page template for specific post. If the template isn’t set, you cant enqueue your script. if ( $post->_wp_page_template === ‘sky-template.php’ ) { wp_enqueue_script(); } Remember to replace sky-template.php with your template file name. Edit: You can get some help from this question. _wp_page_template to dynamically use template