subdirectory index.php is not working

All you should need to do is make sure the appropriate DirectoryIndex is set. For example, at the top of your .htaccess file: DirectoryIndex index.php This instructs mod_dir to try to serve index.php when requesting a directory, eg. /sq/first/. If you are requesting URLs/directories that don’t already contain the trailing slash, as in your example: … Read more

How to send Ajax request from my plugin in admin dashboard?

Here’s a base snippet I use for AJAX submits in WordPress. It does use jQuery, but there’s no reason vanilla won’t work. You could admin_enqueue_scripts() the <script>, and conditionalize it on the proper page with get_current_screen(). add_action( ‘admin_menu’, function(){ add_menu_page( ‘My Plugin’, ‘My Plugin’, ‘manage_options’, ‘my_plugin_slug’, ‘my_plugin_page’, ‘dashicons-cloud’ ); }); function my_plugin_page() { if (isset($_POST[‘my_plugin_ajax_submit’])) … Read more

How to display custom WP menus?

I had the same problem some time ago and solved it by adding my custom menu in my custom theme header.php (inside tag) instead of page.php. wp_nav_menu( array( ‘theme_location’ => ‘my-custom-menu’, ‘container_class’ => ‘custom-menu-class’ ) ); Here you can find a brief explanation about how to create and insert your custom menu Hope you can … Read more

Seach custom post type posts only by meta fields?

This might work, not tested though. First add this to join the postmeta table: add_filter( ‘posts_join’, ‘search_filters_join’, 501, 2 ); function search_filters_join( $join, $query ) { global $wpdb; if ( empty( $query->query_vars[ ‘post_type’ ] ) || $query->query_vars[ ‘post_type’ ] !== ‘product’ ) { return $join; // skip processing } if ( ($this->is_ajax_search() || $this->is_search_page()) && … Read more