Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello @tommiec

    You can use the pre_get_posts filter in WordPress to modify the query on the server side before it gets executed. This way, you can securely add dynamic filtering based on the current user meta without exposing any parameters in the front-end editor.

    function filter_posts_by_user_meta( $query ) {
    if ( ! is_admin() && $query->is_main_query() ) {

    if ( is_user_logged_in() ) {
    $current_user_id = get_current_user_id();


    $user_meta_value = get_user_meta( $current_user_id, 'your_user_meta_key', true );

    // Modify the query to filter posts by the custom post meta
    if ( ! empty( $user_meta_value ) ) {
    $query->set( 'meta_query', array(
    array(
    'key' => 'your_post_meta_key',
    'value' => $user_meta_value,
    'compare' => '='
    ),
    ));
    }
    }
    }
    }
    add_action( 'pre_get_posts', 'filter_posts_by_user_meta' );

    Hello @nabeel56as,

    You can also add custom CSS here to style the menu if your theme doesn’t provide an option. For example:

    .primary-navigation a {
    color: #yourcolorcode; /* Change to your desired color */
    }

    Ensure that the mod_rewrite module is enabled on your server, as it’s required for WordPress to handle URLs properly.

    • You may also want to check if there is an .htaccess file in the root directory and ensure it’s not blocking anything.

    If the theme is overriding your custom content, it’s possible that the page you’re using as the homepage is assigned a custom template that’s different from a default page template. Follow these steps:

    • Go to Pages > All Pages and edit the page that you’ve set as the homepage.
    • On the right-hand sidebar, check for the Page Attributes section. Here, you might see a “Template” dropdown.
      • If a custom template is selected, try switching it to “Default template” or any other template that allows custom content.

    WordPress typically updates the “last modified” date when the post content changes. However, if you’re only updating metadata (like custom fields or post meta) and not the post content itself, the “last modified” date may not update. Ensure that changes are made to the main content of the post to trigger an update.

    Also Sometimes, caching (both server-side and browser caching) can cause the “last modified” date to not display the latest value. Try clearing your browser cache or server cache if applicable. You can also test the issue by disabling any caching plugins temporarily to see if that resolves it.

    WordPress is generally easier to set up with common website functionalities, especially for blogs, landing pages or content-heavy sites. You can save much time, especially with themes, plugins, and the Gutenberg block editor, especially for a simple site. and you can still achieve High Lighthouse scores.

Viewing 6 replies - 1 through 6 (of 6 total)