This worked for me.
Put this in your functions file:
<?php
function example_sc( $atts ){
ob_start();
get_template_part('template','part');
return ob_get_clean();
}
add_shortcode( 'example', 'example_sc' );
?>
Put this in your template file:
<?php
if(get_sub_field('wysiwig')):
$wysiwig = do_shortcode(get_sub_field('wysiwig',false, false));
else:
$wysiwig = '';
endif;
?>
<?php echo $wysiwig; ?>
Also, the field I’m trying to save is not a WP reserved term.
I’m experiencing this exact same issue.
When I enter a url with ‘http://’ into a text field or url field I get a 404 when I save. Works fine if I just enter ‘www.domain.com’.
This issue only happens in an Options page.
I ran into this issue and this article helped http://kovshenin.com/2013/get_template_part-within-shortcodes/.
1. Put the loop in a php file.
2. Then set up your shortcode like this:
function myshortcode( $attr ) {
ob_start();
get_template_part(‘php’,’file’);
return ob_get_clean();
}
add_shortcode( ‘shortcode’, ‘myshortcode’ );