Can’t change the title tag with wp_title filter

When adding title-tag support in a theme, the title tag can be filtered by several filters, but not wp_title. The reason is that if the theme supports title-tag, WordPress uses wp_get_document_title() instead of wp_title(). For themes with support for title-tag you can use document_title_parts: add_filter( ‘document_title_parts’, ‘filter_document_title_parts’ ); function filter_document_title_parts( $title_parts ) { $title_parts[‘title’] = … Read more

Blank on static home page?

From the Codex If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title. Here goes a neat hack to add the description/tagline at the wp_title place on homepage: add_filter( ‘wp_title’, ‘baw_hack_wp_title_for_home’ ); function baw_hack_wp_title_for_home( $title ) { if( empty( $title ) && ( … Read more

Change Default Custom Fields Metabox Name

You need to declare the $wp_meta_boxes array as global: global $wp_meta_boxes; If it still doesn’t work try: add_filter(‘add_meta_boxes’, ‘change_meta_box_titles’); function change_meta_box_titles() { global $wp_meta_boxes; echo ‘<pre>’; print_r($wp_meta_boxes); echo ‘</pre>’; } to see what’s going on (and to check where the title is). You should also prefix your function names to prevent a clash with WP … Read more

Remove “Category Archives: title” at the top of a category page [duplicate]

The text is coming from Twenty Eleven theme’s category.php file. There are two ways to remove it: A) Removing it using a Text/CODE Editor on the File System/FTP: This is the recommended method Go to Your WordPress Installation Folder. Then wp-content/themes/twentyeleven folder. Then open the category.php file in a Text or CODE Editor. On line … Read more

Change post title during post saving process

You can hook into wp_insert_post_data and change things. <?php add_filter(‘wp_insert_post_data’, ‘wpse67262_change_title’); function wpse67262_change_title($data) { $data[‘post_title’] = ‘This will change the title’; return $data; } Obviously you’re going to have to some checks and stuff so you don’t change every post title. That hook will also fire every time the post is saved (adding a new … Read more

query_posts doesn’t order by title

Thanks to Chip Bennett who told me that i’m doing wrong by using query_posts inside content. So i used get_posts and i got what i wanted, thanks! Here is sample of how can you do it, if you got the same problem as me: function some_name(){ global $post; $tmp_post = $post; $args = array( ‘post_type’=>’page’, … Read more

Setting a title on a Custom Post Type that doesn’t support titles

You could add a hidden input into the page to pre-set the title field, because it won’t be on the page(because the type doesn’t support titles). Slug is produced from the title, so you should only need add a title value. Something like this should work(though untested).. add_action( ‘submitpost_box’, ‘hidden_type_title’ ); function hidden_type_title() { global … Read more