Support » Plugin: Google Analytics Top Content Widget » [GaTCW plugin] posts not displayed when permalinks do not contain post slug

  • Resolved rwatuny

    (@rwatuny)


    Hello,

    We have a multilingual site with 5 languages including arabic and chinese.
    Because we had problem with non-roman slugs, we use this permalink structure :
    /%year%/%monthnum%/%day%/%post_id%/

    In the plugin, the mapping from path to post-id is done using the get_page_by_path function which is not able to find posts because this function assumes that the permalink structure contains the post_name as last path part.

    In the class-ga-top-content.php file, I replaced lines 267 to 284 by this :

    $id_p = url_to_postid( $url ) ;
    if ( 0 !== $id_p ) {
    	$wppost = get_post( $id_p ) ;
    }

    And it works.

    Regards.

    https://wordpress.org/plugins/google-analytics-top-posts-widget/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[GaTCW plugin] posts not displayed when permalinks do not contain post slug’ is closed to new replies.