Why can I not deregister my style and script on custom post type?

Question

I have a website where I have a custom post type with some single pages attached to it.

Problem: I can’t deregister the scripts and styles on my custom post type single pages.

This is my code:

add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );

function my_deregister_javascript() {
   if (is_page(array(20720, 38881))) {
    wp_deregister_script( 'basic-comment-quicktags' );
     }
        elseif (is_home()) {     
        wp_deregister_script( 'theme-my-login-ajax' );
     }

     elseif (is_singular( 'name-of-my-custom-post-type' )) {
        wp_deregister_script( 'incom-js');
     }

        elseif (is_page(array(alfabet-page))) {
    wp_deregister_script( 'wp-favroite-posts' );
    wp_deregister_script( 'basic-comment-quicktags' );
     }

So you can see that I am using it like this:

 elseif (is_singular( 'name-of-my-custom-post-type' )) {
    wp_deregister_script( 'incom-js');
 }

Yet this does not work for me. What am I doing wrong?

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/why-can-i-not-deregister-my-style-and-script-on-custom-post-type/">

Why can I not deregister my style and script on custom post type?</a>
0
, , , , Siyah 2 months 0 Answers 33 views 0

Leave an answer