Automattic / Automattic/WP-Job-Manager
has_wpjm_shortcode array_intersect discards passed shortcodes (unless added via another filter)
- Dominant language
- PHP
- Stars
- 899
- Forks
- 369
- Avg merge
- 11h 37m
- Merged PRs (30d)
- 12
Description
https://github.com/Automattic/WP-Job-Manager/blob/c5c57804536423b11508202a79faa5c17fab5287/wp-job-manager-functions.php#L788
Why is `array_intersect` being used here? I understand that `job_manager_shortcodes` can be used to add shortcodes, but doesn't this kind of defeat the purpose of allowing shortcodes to be passed in `$tag` argument? This basically causes any passed shortcodes in `$tag` to be discarded if they are not also added via `job_manager_shortcodes` filter.
I understand this would allow you to check for a specific shortcode, but ONLY ones that exist in `job_manager_shortcodes` as well ... and since Resume Manager does not add any of the shortcodes using `job_manager_shortcodes` filter ... it will return false, even if you pass `submit_resume_form` to `has_wpjm_shortcode`
Is this the intended functionality for `has_wpjm_shortcode`?
Contributor guide
Research direction
Start in wp-job-manager-functions.php around line 788 and read has_wpjm_shortcode, focusing on how the passed $tag argument is combined with the job_manager_shortcodes filter. Reproduce the submit_resume_form case described in the issue and check existing tests or shortcode handling nearby. Done means the intended behavior for passed shortcodes is established and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100