I have a plugin that requires scripts to load for an admin panel in the page-attributes template drop-down on page post type.
However this script causes a Uncaught TypeError:
on post post types which is a correct response and I understand that is not where my focus should turn.
Since this script is only necessary for the page post type, I believe the best solution is to conditionally format my script so it works as such.
Due diligence was taken to find and work this out, but without much luck. In class-wp-screen.php
, 95, I find $parent_base
, but I do not know how to format this to meet the conditions.
My code to be modified
add_action('admin_enqueue_scripts', 'gp_front_page_script');
function gp_front_page_script()
{
if ( isset( $_GET['post']) && isset( $_GET['action']) && $_GET['action'] == 'edit' )
{
wp_enqueue_script('gp_fp',
plugins_url() . '/network-plugins/includes/globals/genpages/front-page.js',
array('jquery'));
}
}
How do I format a condition to load a script on edit.php?post_type=page
and not any other screen i.e. edit.php
?