Issue with pre_get_posts on custom post type archive pages

If we look in source, we’ll see under what conditions is_archive is true: if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) $this->is_archive = true; The issue is that is_archive is triggering your filter on your post type archive. If you want to exclude those, either make sure it’s not … Read more

building plugin and it is displaying above plugins page

You’re using add_menu_page wrong. The function bittech_login_settings should be only: function bittech_login_settings() { add_menu_page( ‘BitTech Login Settings’, ‘BitTech Login Settings’, ‘add_users’, ‘bittech_settings’, ‘bittech_login_settings_callback’ ); } function bittech_login_settings_callback() { // content of the menu } And put the contents of the page in the callback function bittech_login_settings_callback. Also, these lines don’t make much sense: $filename = … Read more

Loading jQuery and jQuery plugin script files correctly [duplicate]

Add the jquery script as a dependency for your jquery-ticker.js and site.js files within the wp_enqueue_script function. Example: function bbc_frontend_script() { wp_enqueue_script(‘ticker’, plugins_url(“/js/jquery-ticker.js”, __FILE__), array( ‘jquery’ ) ); wp_enqueue_script(‘sitejs’, plugins_url(“/js/site.js”, __FILE__), array( ‘jquery’, ‘ticker’ ) ); } add_action( ‘wp_enqueue_scripts’, ‘bbc_frontend_script’ ); You also don’t have to enqueue jquery separately if you define it as a … Read more

Cache directory needed for plugin

If you observe how the popular caching plugins like WP Super Cache or W3TC utilize a cache folder within wp-content as well as other plugins who utilize uploads or cachable files it would be appropriate to create a folder within that structure. A side issue may arise if the user has a locked down folder … Read more