Opened 20 months ago

Closed 7 months ago

Last modified 7 months ago

#6570 closed enhancement (wontfix)

Add full function reference to og:title meta head for code reference pages

Reported by: aurovrata's profile aurovrata Owned by:
Milestone: Priority: normal
Component: Developer Hub Keywords: close 2nd-opinion


Currently a search on Google for a code reference such as a 'get_meta_post' returns the code reference page for that function, which has the its og:title meta head set to,

get_post_meta() | Function | WordPress Developer Resources

It would be very useful to add the full function reference,

get_post_meta( int $post_id, string $key = "", bool $single = false ): mixed | Function | WordPress Developer Resources

as it would enable a quick reference without having to actually open the page.

I find myself forgetting some function variables, or their order, and having this information right there in the Google search results would be very handy.

Change History (4)

#1 @dd32
20 months ago

  • Keywords close 2nd-opinion added

Unfortunately titles displayed in search engines are limited in characters, you can kind of see this in action if you search Google for WP_REST_Application_Passwords_Controller where you'll find that it discards the actual <title> & og:title and goes for the <h1> instead.

The description shown is also character limited, ~130char as in the example of register_block_script_handle, which if the function syntax was added, would leave little room for an actual human-readable description (and I honestly believe Search Engines would internally decide that code isn't human readable, so isn't a good result, and so would source it from elsewhere on the page, like the above <h1> example).

I don't really see this as being a viable change.

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.

20 months ago

#3 @coffee2code
7 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

I agree with Dion here. A lot of the function titles will be prohibitively long and the change will end up ensuring that the explicit title we set will be ignored by Google. And having more stuff in the title dilutes the important part (the function/class/hook name). Plus, I think we're better off having people click through to get the full context of the function signature documentation rather than trying to cram everything into the title to save some people a click through to the site.

#4 @aurovrata
7 months ago

@dd32 that makes a lot of sense. So how about the description instead? Looking at the get_post_meta() doc page it currently holds,

<meta property="og:description" content="Retrieves a post meta field for the given post ID.">

and could easily accommodate the full function reference.

Note: See TracTickets for help on using tickets.