Search custom taxonomy term by name

// We get a list taxonomies on the search box function get_tax_by_search($search_text){ $args = array( ‘taxonomy’ => array( ‘my_tax’ ), // taxonomy name ‘orderby’ => ‘id’, ‘order’ => ‘ASC’, ‘hide_empty’ => true, ‘fields’ => ‘all’, ‘name__like’ => $search_text ); $terms = get_terms( $args ); $count = count($terms); if($count > 0){ echo “<ul>”; foreach ($terms as … Read more

Remove index.php in permalink structure on IIS server

According to the documentation here: http://www.iis.net/learn/extensions/url-rewrite-module/enabling-pretty-permalinks-in-wordpress I assume you have already selected Post Name in your permalink structure: Then include this code in web.config <rewrite> <rules> <rule name=”Main Rule” stopProcessing=”true”> <match url=”.*” /> <conditions logicalGrouping=”MatchAll”> <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” /> <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” /> </conditions> <action type=”Rewrite” url=”index.php” /> </rule> </rules> </rewrite>

Permalink not working for page without title

TL;DR: go the the edit post screen, clear the Post permalink/slug (found immediately below the Post Title field) by clicking “Edit”, and then deleting the existing text, and save. So, what’s happening here: On the site where the Theme Unit Test data are hosted, the ID of the post in question is 14. When you … Read more

Post type child of another post type

Attachments are post types someway, when you attach images to a post/page and display them in your post, you get a link like your-post-title/attachment/filename/. Maybe you can create post types with hierarchical option and them filter the link to replace the attachment to post parent name instead.

Rewrite rule for Custom post type Monthly and Yearly archive

I used this to enable yearly and monthly archive for custom post type. Just drop in this code into your functions.php file. This will add your custom rule right on the top of the Rules array. NB – WordPress uses rules array to store rewrite rules. <?php function wpse22992_custom_post_rewrite( $rewrite_rules ) { $cpslug = ‘contest_recipe’; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)