Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly extract URLs from shortcodes in 'links' field of pdc-item for REST API #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mvdhoek1
Copy link
Contributor

Shortcodes van verscheidene OWC plugins bevatten HTML elementen zoals tags.
De output hiervan is correct voor de post_content maar niet in API velden waar links in horen te staan.

Editor PDC-item:
Scherm­afbeelding 2025-01-10 om 08 02 18

Output van zo'n shortcode:
Scherm­afbeelding 2025-01-10 om 08 02 33

Voor:
Scherm­afbeelding 2025-01-10 om 08 12 54

Na:
Scherm­afbeelding 2025-01-10 om 08 09 53

@mvdhoek1 mvdhoek1 force-pushed the fix/url-from-shortcodes-pdc-item-links-rest-api-field branch from a70b38c to bda3320 Compare January 10, 2025 07:26
*
* @param WP_Post $post
*
* @return array
*/
public function create(WP_Post $post): array
{
return array_map(function ($link) {
$shortcode = isset($link['pdc_links_shortcode']) ? do_shortcode($link['pdc_links_shortcode']) : '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm deze do_shortcode zou een check moeten hebben op het type shortcode.

@mvdhoek1 mvdhoek1 force-pushed the fix/url-from-shortcodes-pdc-item-links-rest-api-field branch from bda3320 to bd451b9 Compare January 10, 2025 12:10
@mvdhoek1 mvdhoek1 force-pushed the fix/url-from-shortcodes-pdc-item-links-rest-api-field branch from bd451b9 to d4d40a7 Compare January 10, 2025 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants