Filter get_the_title to remove certain characters?

The function the_title() is just a wrapper around the function get_the_title(). It’s understandably confusing that the filter the_title actually exists inside get_the_title(). So, whatever the function you’re using to actually display it, it doesn’t matter, you can filter its content by hooking into the_title

Wp query orderby ‘title’ doesn’t work

Try adding ‘suppress_filters’ => true to your query args. Maybe you have a plugin that modifies the queries. You could also check if the posts out of order (the first one) is a sticky post. Sticky posts by default skip the order queue. You can disable this by adding ‘ignore_sticky_posts’ => true to your query … Read more

How to get post category title within the loop?

The function get_the_category() returns an array of category objects. To get the name of the first category, use this: $categories = get_the_category(); $cat_name = $categories[0]->cat_name; For a list of the properties of the category object, see the documentation on get_the_category()

Get title of page from URL

WordPress has a function called url_to_postid that may work in this situation. You can try the following (untested): <?php $url = htmlspecialchars($_SERVER[‘HTTP_REFERER’]); $back_id = url_to_postid($_SERVER[‘HTTP_REFERER’]); if( $back_id > 0 ){ $back_title = get_the_title( $back_id ); echo “<a href=”https://wordpress.stackexchange.com/questions/211840/{$url}”>Go back to the {$back_title}</a>”; }

Change separators in HTML tags

It all depends on how your theme’s header.php is structured, but the most likely way is via the document_title_separator filter, as in add_filter (‘document_title_separator’, ‘wpse_set_document_title_separator’) ; function wpse_set_document_title_separator ($sep) { return (‘|’) ; }

How Can i Get 5 Recent Post Title With Corresponding Link?

This sounds like an additional Loop on that page, right? You might want to use: <ul> <?php $posts_query = new WP_Query(‘posts_per_page=5’); while ($posts_query->have_posts()) : $posts_query->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/20489/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endwhile; wp_reset_query(); ?> </ul> Also read more here: http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action

Blank space at beginning of tag?

It looks like your site’s title is empty. Fill it out or try for example: add_filter( ‘wp_title’, function( $title ) { return trim( $title ); } ); to remove the blank space in front. For your setup, the following part of wp_title() is responsible for the blank space: $title = $prefix . implode( ” $sep … Read more

Change title tag dynamically or within plugin?

As of WP 4.4, wp_title is deprecated. If you simply need to override your title tag, pre_get_document_title is the filter you want to use. add_filter( ‘pre_get_document_title’, ‘generate_custom_title’, 10 ); and the function would look something like this function generate_custom_title($title) { /* your code to generate the new title and assign the $title var to it… … Read more

Title and post URL based on custom fields?

I think a good way to do what you want is hook the wp_insert_post_data filter. Here you can change the title and slug of the post before it is saved to database: add_filter( ‘wp_insert_post_data’, ‘wpse_update_post_title_and_slug’ ); function wpse_update_post_title_and_slug( $data ) { //You can make some checks here before modify the post data. //For example, limit … Read more