Duplicate content issue with ?p= parameter on paginated pages

Posted in: Newspaper
Post count: 31

Hello,

we are seeing an issue with the Newspaper theme where arbitrary ?p= query parameters are accepted on paginated archive pages.

### Examples:

* https://www.4kfilme.de/page/15/?p=test
* https://www.womeninadria.com/page/15/?p=blabla

### Behavior:

* Any ?p= value (even invalid strings) still renders a normal archive page
* No redirect or 404 is triggered
* Multiple URL variants return identical content

### Impact:

* Duplicate URLs are indexed by Google
* “Duplicate, Google chose different canonical” warnings in Search Console

### Question:

Is this expected behavior, and is there a recommended way to handle or block such query parameters to avoid duplicate content?

Thanks in advance.

Post count: 35449

Hi,
What you’re seeing is not a bug in the theme; it’s more of a WordPress core behavior that handles queries.
In WordPress, the ?p= parameter is normally used for post IDs (e.g. ?p=123). But:
– if the value is invalid (?p=test)
– and you’re already on a valid URL (like /page/15/)
WordPress simply ignores the invalid parameter instead of throwing a 404.

What you can do is to use a redirect plugin (s1). Install the plugin Redirection
Go to: Tools → Redirection
Add a new redirect:
– Source URL: /page/(.*)
– Query Parameters: p (match any value)
– Target URL: /page/$1
– Match: Regex (enable this option)
– Save the redirect
This will automatically remove ?p=anything from URLs and redirect to the clean version.

Another solution (s2) is to use a code in functions.php file (recomanded in a child theme)
function remove_invalid_p_parameter() {
if (isset($_GET['p']) && !is_numeric($_GET['p'])) {
wp_redirect(remove_query_arg('p'), 301);
exit;
}
}
add_action('template_redirect', 'remove_invalid_p_parameter');

Also, using a SEO plugin could help. These add canonical URLs, helping Google understand the correct page.

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.