Setting title using wp_title filter

Since wp_title() is usually called from the header.php file of your theme, then it runs on every page of your WordPress (frontend usually). So place the filter hook and function in your theme’s functions.php file, and just check if it’s a blog post before you change the title. Something like this: add_filter(‘wp_title’, ‘filter_pagetitle’); function filter_pagetitle($title) … Read more

Automatically add title attribute to links in WordPress

Don’t know if this works but it should, function get_page_title($url){ if( !class_exists( ‘WP_Http’ ) ) include_once( ABSPATH . WPINC. ‘/class-http.php’ ); $request = new WP_Http; $result = $request->request( $url ); if( is_wp_error( $result ) ) return false; if( preg_match(“#<title>(.+)<\/title>#iU”, $result, $t)) { return trim($t[1]); } else { return false; } } add_filter(‘the_content’,’auto_add_title_to_link’); function auto_add_title_to_link($content){ $html … Read more

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.

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