Skip to content

Instantly share code, notes, and snippets.

View mountbatt's full-sized avatar

Tobias Battenberg mountbatt

View GitHub Profile
@Genyus
Genyus / functions.php
Created March 4, 2022 21:39
Fix for broken Elementor landing pages when using custom permalinks (v3.4.3+)
/**
* Fixes landing page 404 when non-standard permalinks are enabled.
*
* @param \WP_Query $query
*/
function elementor_pre_get_posts( \WP_Query $query ) {
if (
// If the post type includes the Elementor landing page CPT.
class_exists( '\Elementor\Modules\LandingPages\Module' )
&& is_array( $query->get( 'post_type' ) )