Support » Plugin: NextScripts: Social Networks Auto-Poster » Fix for enqueuing style and scripts in any post

  • Resolved dspaete

    (@dspaete)


    In order to prevent SNAP from enqueuing styles and scripts on the edit screen of post types which are not activated via options page I changed
    ./inc/nxs_functions_wp.php
    line
    if (isset($_GET['post_type']) && !in_array($_GET['post_type'], $options['fltrs']['nxs_post_type'])) return;
    to
    if ((isset($_GET['post_type']) && !in_array($_GET['post_type'], $options['fltrs']['nxs_post_type'])) || ($screen->base == 'post' && !in_array($screen->id, $options['fltrs']['nxs_post_type']))) return;

    Works fine for me. I would appreciate a solution like this in a future release 😉

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author NextScripts

    (@nextscripts)

    Thanks for the suggestion, but your way is overdoing it. Also $screen->id is not officially documented to act as post_type. There is an actual post_type in the $screen.

    if ( $screen->base == 'post' && !in_array($screen->post_type, $options['fltrs']['nxs_post_type']) ) return;

    will do the same

    dspaete

    (@dspaete)

    You’re right, it’s better this way. Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fix for enqueuing style and scripts in any post’ is closed to new replies.