WordPress / WordPress/Documentation-Issue-Tracker

Code example in JavaScript misleadingly labelled as PHP

Open
#2,020 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

developer documentation (DevHub)
Dominant language
Shell
Stars
109
Forks
73
PR merge metrics
No merged PRs in 30d

Description

Issue Description

The code example for using wp-script-module-data- in client-side JavaScript is misleadingly labelled as PHP due to it being pulled from a doc-block in a PHP file.

URL of the Page with the Issue

https://developer.wordpress.org/reference/hooks/script_module_data_module_id/

Section of Page with the issue

The second code example under the "Description" section

Why is this a problem?

It's not clear that the code example is in JavaScript

Suggested Fix

Ideally change the code container block header to make it clear that this is JavaScript, or if that's not possible: include a sample .js filename in the code snippet

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the referenced hook documentation page and inspect the second code example under the Description section, along with the PHP doc-block that supplies it. Make the rendered example clearly identify JavaScript, then verify that the page displays the corrected language label or filename.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.