Creating a Video Content Page (how to use query strings in wordpress)- Help!

Welcome to WPSE. There’s probably more than one way to do this, but here’s my first thoughts.

The first thing you may want to do is to register a custom post type (CPT) for the video content. This way you can have “video library” at the backend (i.e. Dashboard) for managing the video content.

If you don’t need to add long text content to be shown along the video, you can set the CPT support arguments as title, excerpt, and thumbnail. To disable block editor for the CPT set 'show_in_rest'=>false. To store the video url you can register a custom meta box. Storing meta data with block editor requires a bit more involvement, if you decide to use it.

To display the videos on the frontend you can either set the CPT to visibility argument 'public'=>true and create custom single template or make the CPT private ('public'=>false) and create a custom page template where you display videos by getting the id from a query string (i.e. $video_id = $_GET['video_id']). You may want to familiarize yourself with the concept of the Loop, if you haven’t already, regardless which template type you use.

If your CPT is public, you use a custom single template, and you’ve stored the video url to post meta, then you can retrieve it in the template file with get_post_meta(). WP takes care of creating shareable permalink for the video post.

If your CPT is private, then you could store the video id to the custom post’s slug field (post_name) and video url to post meta. In your custom page template you could then first use get_page_by_path() (works for CPT’s too) with the video id from query string to get the post ID to be used with get_post_meta() to eventually get the video url. Another option is to use WP_Query with ‘name’=>$video_id with ‘fields’=>’ids’ to query the post ID.

tech