How to get shortcode to work inside a foreach loop called within a shortcode?

The issue is you are echoing raw post_content field from object. It isn’t what usually gets to front-end. Try: apply_filters( ‘the_content’, $post->post_content ) If you want to run shortcodes alone (without bunch of other filters) you can do: do_shortcode( $post->post_content ) Edit re-read your question… Is there a possibility that this thing gets recursive? Post … Read more

Format content value from DB outside of WordPress filters

There are a few filters and actions here that run. You’d need to look at the code and figure out what/how to utilize these. https://codex.wordpress.org/Function_Reference/wpautop https://codex.wordpress.org/Function_Reference/wptexturize https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content https://developer.wordpress.org/reference/functions/do_shortcode/ https://developer.wordpress.org/reference/functions/unescape_invalid_shortcodes/ https://developer.wordpress.org/reference/functions/get_shortcode_regex/

Get shortcode attributes outside shortcode function

You can pass an array to your script with wp_localize_script($handle, $object_name, $l10n). function test_function( $atts ) { $data = shortcode_atts( array ( ‘arrows’ => TRUE ), $atts ); wp_enqueue_script( ‘your_script_name’ ); wp_localize_script( ‘your_script_name’, ‘yourScriptObject’, $data ); return ‘a string’; } In your (external) script you can access the shortcode data now with … var arrows … Read more

Shortcode returns escaped HTML tags

I would recommend using single quotes if you want to include some HTML, also you need to return something otherwise nothing happens. // WP Shortcode function text_shortcode() { return ‘<strong>bold text:</strong> <a href=”https://wordpress.stackexchange.com/questions/318934/shortcode-returns-escaped-html-tags”>See wordpress.stackexchange.com</a>’; } add_shortcode(‘bold-text’, ‘text_shortcode’); Your WordPress shortcode would be: [bold-text] Edit: You don’t need html_entity_decode or htmlentities only when you’re doing something … Read more

Getting attribute value from shortcode

I read your question differently than @eric-holmes. It sounds to me like your shortcode needs to function normally under most circumstances but that you are extracting information in special circumstances. Shortcode regex is tricky. Let WordPress do it for you. $pattern = get_shortcode_regex(); preg_match_all(“/$pattern/”,$wp_content,$matches); Your attributes for any shortcodes present in $wp_content should now be … Read more

Ajax, filters and shortcodes

When WordPress displays post content, it’s not running do_shortcode() on the post content, it’s running apply_filters( ‘the_content’, $content ). Shortcode filters are applied on the_content filter, which is why you have to add extra filters to get them to work in widgets or the footer or elsewhere.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)