Setting Parent Page to Post

This should be in a comment, but can’t format much in there.

  1. Create a relationship between your CPT and Page. For example, create a custom taxonomy for your CPT and programatically add the pages as terms. Or, you can even create a meta field.

  2. Create a placeholder for the URL while registering the CPT. For example 'rewrite' => array( 'slug' => '%cpttag%'),.

  3. str_replace the placeholder with page slug you get from term/meta using post_type_link.

  4. Flush the permalinks (Just hitting Save on Permalinks Settings page will do it)