Support » Plugin: Genesis Simple Share » Can it keep the query string?

  • I’m trying to use this plugin to share pages that have query strings. I noticed that it strips it when sharing. Can that be modified?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Nick C


    You could try filtering get_permalink() in your theme’s functions.php:

    // Retain query string for share buttons on posts and pages
    add_filter( 'post_link', 'custom_retain_query_string' );
    add_filter( 'page_link', 'custom_retain_query_string' );
    function custom_retain_query_string( $permalink ) {
    	$current_url       = home_url( add_query_arg( null, null ) );
    	$current_url_parts = explode( '?', $current_url );
    	if ( strtolower( $current_url_parts[0] ) === strtolower( $permalink ) ) {
    		return $current_url;
    	return $permalink;

    That will include the query string in the current URL if you’re viewing the post itself when you click the share buttons.

    Note that this could affect the share counts, though. Some social networks such as Google Plus see the URL with the query string as a different URL to the plain one, so by doing this you’re likely to reduce overall share counts.

    Thread Starter Ricardo


    It works like a charm! Thank you. The query strings define different albums from Google Photos so it makes sense that they are separate.

    Thank you for your time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can it keep the query string?’ is closed to new replies.