• Hello Anthony and Team,

    Consider this simple “Hello World” example:

    function map_my_sc() { 
    	if ( function_exists( 'kc_add_map' ) ) { 
    	    kc_add_map(
    	        array( 
    	            'hello_world' => array(
    	                'name' => 'Hello Test',
    	                'description' => 'Just a test',
    	                'category' => 'Content',
    	                'params' => array(
    	                    array(
    	                        'name' => 'Title',
    	                        'label' => 'Enter a title',
    	                        'type' => 'textfield',
    	                        'admin_label' => true,
    	                    )	
    					)			
    				) 
    	        )
    	    );
    	}
    }
    
    add_action( 'init', 'map_my_sc', 99 );
    
    function hello_world_sc() {
    	return 'Hello world original text';
    }
    
    function add_hello_world_sc() {
    	add_shortcode( 'hello_world', 'hello_world_sc' );
    }
    
    add_action( 'init', 'add_hello_world_sc' );

    General Case: This shortcode is mapped to KC, and is used in a post via pagebuilder element. It shows corect output on single posts and archives.

    Issue: When the output of shortcode is modified to, say, example below:

    function hello_world_sc() {
    	return 'Hello world modified text and some more stuff';
    }

    This output is updated on single posts successfully, but not in archives which show either post excerpt or post content using the_excerpt() or the_content(). Upon further testing, if I place the same shortcode in “Classic” mode in a post, the output is updated on archives. But if the shortcode is placed via KC Pagebuilder, the output is not updated in archives.

    The output only updates if I open the post and then click the update button. The problem becomes more serious when these posts do not update via “Bulk edit” feature. You need to open individual posts to update them.

    I have tested this with twentyseventeen theme and two other custom themes with all other plugins disabled. I encountered this issue when creating a custom add on for KC. During development, I had to modify the shortcode output several times, and I was surprised to see old content again and again in archives. No caching plugins are used, and Kingcomposer’s built in cache is also disabled. Please advise what can be done to prevent this caching.

    Thanks in advance.

    Kind regards

    • This topic was modified 7 years, 9 months ago by desertsailors.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Archive post content doesn’t update if the shortcode output was modified’ is closed to new replies.