I've been playing with custom post types & custom fields, using a combination of the types plugin and the advanced custom fields plugin, also having done the same manually.

Occasionally I want to create a CPT where a title would be inappropriate - for example, an FAQ where I want two fields labelled Question and Answer. This does work without a title, however they all get saved as (No Title).

What I'd like to do is either set the title to the value of the Question custom field, or somehow define my own title field that I can label as I like.

Does anyone have any pointers on how to acheive this?

  • 1
    Why not use the title rather than the question field for the actual question? – Stephen Harris May 11 '12 at 10:31
  • @StephenHarris because I can't label the title field as a 'Question', it would be unclear to the user what to do. As I mentioned in the question, if anyone can tell me how to relabel that then that's what I would use – jammypeach May 11 '12 at 10:36

You can use the enter_title_here filter:

    function wpse51871_alter_title_label($label, $post){
        if( 'question' == get_post_type($post) )
            $label = __('enter question here', 'my-plugin-text-domain');

        return $label;
  • that's prefect, thanks! one other solution I was playing with was a bit of javascript to hide the title & update the value but this is much more elegant. thanks for sharing :) – jammypeach May 11 '12 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.