WordPress page title repeated in SOME pages

In order to play nicely with Plugins or other code that attempts to modify the HTML document title content (i.e. wp_title() output), you should always and only output this: <title><?php wp_title( ” ); ?></title> …and if you want to modify that output yourself, filter wp_title instead of hard-coding anything inside the <title></title> tags. So for … Read more

Search Post Title Only [duplicate]

I didn’t test the code below, but I guess it works. /** * Search SQL filter for matching against post title only. */ function __search_by_title_only( $search, &$wp_query ) { /*my solution */ if($_GET[‘post_type’] != ‘attorney’ ) return $search; /*my solution*/ //please copy the rest of the code from the link below } add_filter( ‘posts_search’, ‘__search_by_title_only’, … Read more

Using a Custom Field instead of original title field but only for Custom Post Type

The solution you are working on will always represent multiple database inserts as the post will be saved and then the the title re-saved in a second database write. That is the nature of the save_post hook, since it runs after the primary post save. Additionally, the code you found is wildly overcomplicated. Interestingly, the … Read more

How to update a custom post title from a front-end form using ACF fields?

You check if !$value before assigning the title from the fields, that test will be false once the post has a title. If you always want it to update, then remove the test. function auto_title_insert() { return $_POST[‘fields’][‘field_538626f57e84c’].’ ‘.$_POST[‘fields’][‘field_538627ffeccb0′].’ ‘.$_POST[‘fields’][‘field_53863a5c7502b’].’ ‘.$_POST[‘fields’][‘fields[field_53a9bb09f82ba]’]; } add_filter( ‘title_save_pre’, ‘auto_title_insert’ );

Replace URL with Site Title in Search Results

What you are seeing is correct. Google display in SERPs (Search Engine Results Pages) listing as follows: URL Page Title Page Description [ other attributes (potentially) ] Your top result: Tattini Boots – 1860 | Italian English Riding Boots – U.S Links to: https://www.tattiniboots.com/ …your homepage.

Include category title in wp_title

Create a helper function to get all parent categories (each post can be in multiple categories): function parent_cat_names( $sep = ‘|’ ) { if ( ! is_single() or array() === $categories = get_the_category() ) return ”; $parents = array (); foreach ( $categories as $category ) { $parent = end( get_ancestors( $category->term_id, ‘category’ ) ); … Read more

Display all posts with same title

Lets use the build in features WordPress has to offer. It is almost always not adviced to use custom SQL whenever WordPress offers native functions to perform the specific duty. To query our posts, we will make use of WP_Query. The only problem is, WP_Query does not support the feature where we look for posts … Read more