Custom Taxonomies Terms as Post Title for Custom Post Types upon Publishing

I’ve pieced together a solution. Let me know if it’s what you need: add_filter(‘the_title’,’term_filter’,10,2); function term_filter($title, $post) { $post = get_post($post) ; if($post->post_type === ‘special_post_type’) { $terms = wp_get_object_terms($post->ID, ‘taxonomy’); if(!is_wp_error($terms) && !empty($terms)) { $title = $terms[0]->name; } } return $title; } Basically, I’m using a filter for the title that checks what post type … Read more

What hook is executed just after wp_query has been executed?

Yep you’re right template_redirect is fired right after wp which performs the query. A very useful plugin you might want to look at is: https://wordpress.org/plugins/query-monitor/ This can help you to see what’s loaded on a particular page during development, in addition to what hook is used

What is the use of $page_title and how to use it?

Ok my bad found the answer on the codex page but at the very bottom so I’m adding this here as well so if anyone like my didn’t catch it on WordPress’s codex, they can find it here 🙂 Just use get_admin_page_title(); See the example 1 below: function register_my_custom_submenu_page() { add_submenu_page( ‘tools.php’, ‘My Custom Submenu … Read more

Filter Widget Title Wrap

The filter to do this is dynamic_sidebar_params also see this tutorial on this filter at ACF’s site (even if you don’t use ACF). function prefix_filter_widget_title_tag( $params ) { $params[0][‘before_title’] = ‘<h2 class=”widget-title widgettitle”>’ ; $params[0][‘after_title’] = ‘</h2>’ ; return $params; } add_filter( ‘dynamic_sidebar_params’ , ‘prefix_filter_widget_title_tag’ );

Verify if tag is used on posts

Try using the has_tag() conditional template tag. e.g., to query for the tag “foobar”: <?php if ( has_tag( ‘foobar’ ) ) { // The current post has the tag “foobar”; // do something } else { // The current post DOES NOT have the tag “foobar”; // do something else } ?> If you’re inside … Read more

Get title of post without using the_title();

This is because the_title() echos the post title (see the linked documentation). Use get_the_title() instead which returns the title as a string. Edit You have two options: Use get_the_title() to return, rather than echo, the post title Filter the_title to echo a custom string as the post title Using get_the_title() <?php // NOTE: Inside the … Read more