Skip to content

Commit ced2c3b

Browse files
committed
Correct slugs
1 parent 8080ac1 commit ced2c3b

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

admin/class-gappv-admin.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,7 @@ public function ajax_views_update() {
456456
return $total_views;
457457
}
458458

459-
$basename = basename( get_permalink( $post_id ) );
460-
$link = '/' . $basename . '/';
459+
$link = wp_make_link_relative( get_permalink( $post_id ) );
461460
$post_date = get_the_date( 'Y-m-d', $post_id );
462461

463462
if ( isset( $options['start-date'] ) && strtotime( $post_date ) < strtotime( $options['start-date'] ) ) {

includes/class-gappv-wp-cli-commands.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public function populate() {
1717
if ( ! class_exists( 'Gappv_Admin' ) ) {
1818
WP_CLI::line( __( 'Gappv_Admin Class does not exist!', 'gappv' ) );
1919
}
20-
$gappv = new Gappv_Admin( 'gappv', GAPPV_VERSION );
21-
$args = array(
20+
$gappv = new Gappv_Admin( 'gappv', GAPPV_VERSION );
21+
$args = array(
2222
'post_type' => 'post',
2323
'post_status' => 'publish',
2424
'meta_query' => array(
@@ -31,24 +31,22 @@ public function populate() {
3131
'orderby' => 'date',
3232
'order' => 'DESC',
3333
);
34-
$query = new WP_Query( $args );
35-
$output = '';
34+
$query = new WP_Query( $args );
35+
$output = '';
3636
if ( $query->have_posts() ) {
3737
while ( $query->have_posts() ) {
3838
$query->the_post();
3939
$post_id = get_the_ID();
40-
$basename = basename( get_permalink( $post_id ) );
41-
$link = '/' . $basename . '/';
40+
$link = wp_make_link_relative( get_permalink( $post_id ) );
4241
$post_date = get_the_date( 'Y-m-d', $post_id );
4342
$views = $gappv->call_api( $post_id, $link, $post_date );
44-
$output .= WP_CLI::line( sprintf( __( 'Post Path: %1$s, Views: %2$d', 'gappv' ), $link, $views ) );
43+
$output .= WP_CLI::line( sprintf( __( 'Post Path: %1$s, Views: %2$d', 'gappv' ), $link, $views ) );
4544
}
4645
}
4746
wp_reset_postdata();
4847
}
4948

5049

51-
5250
}
5351

5452
WP_CLI::add_command( 'gappv', 'Gappv_Wp_Cli_Commands' );

0 commit comments

Comments
 (0)