Archives using a content template in Bedrock isn’t measured properly
-
Hello! I just noticed that archives that use a content template don’t seem to measure views properly. I’ve noticed in the past that get_the_id() inside such a template isn’t working quite like it should, so maybe this is unsolveable. Still making a report in case you’re a wizard or something. If not, I’ll just convert it to a page instead, no worries.
Here’s the network request in the browser console log. Note how “source_id” is empty:wp_statistics_hit: 1
source_type: archive
source_id: 0
search_query:
signature: fbad2f2b908b9dc26ec8689cc3fca8d6
action: wp_statistics_hit_record
referred: aHR0cHM6Ly93d3cud2luZXRhYmxlLnNlLw==
page_uri: L3JlY2VwdC8=The page is generated from this file:
site/web/app/themes/example/resources/views/partials/content/content-recept.blade.phpHow it’s registered in setup.php:
register_post_type(
'recept',
[
'labels' => [
'name' => _x('Recept', 'post type general name'),
'singular_name' => _x('Recept', 'post type singular name'),
'add_new' => _x('Lägg till Recept', 'book'),
'add_new_item' => __('Lägg till nytt Recept'),
'edit_item' => __('Redigera Recept'),
'new_item' => __('Nytt Recept'),
'all_items' => __('Alla Recept'),
'view_item' => __('Se Recept'),
'search_items' => __('Sök Recept'),
'not_found' => __('Inga Recept hittade'),
'not_found_in_trash' => __('Inga Recept hittade i papperskorgen'),
'parent_item_colon' => '',
'menu_name' => 'Recept',
],
'description' => 'Holds our Recept and Recept specific data',
'public' => true,
'supports' => ['title', 'editor', 'thumbnail', 'excerpt', 'revisions'],
'has_archive' => true,
'taxonomies' => [],
'hierarchical' => true,
'menu_position' => 2,
'rewrite' => ['slug' => 'recept', 'with_front' => false],
]
);The page I need help with: [log in to see the link]
The topic ‘Archives using a content template in Bedrock isn’t measured properly’ is closed to new replies.