• Resolved spikerrbg

    (@spikerrbg)


    Hello.
    Im use shortcode for custom post type.
    When im update last version nothing show on custom post type.
    Is blank. Im try to regenerate css nothing happen. When im make pre view whit elementor its show but when going on website not show.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author mapster

    (@mapster)

    Hello! Can you give the link to the site where you’re trying to show the map, so I can check if there are any errors on the front end? Thanks, and sorry about the issues!

    Thread Starter spikerrbg

    (@spikerrbg)

    Sure give me your email cuz not wanna share public picture and administrator username or password

    Plugin Author mapster

    (@mapster)

    Yes, it’s [email protected]

    Thread Starter spikerrbg

    (@spikerrbg)

    Hello im find were is problem. Im use code for block not register user to use wp-json.
    Your plugin request wp-json.
    Look picture: https://ibb.co/wNnq5Bs
    This is code im use to stop not register people use JSON.

    add_filter( 'rest_authentication_errors', function( $result ) {
        // If a previous authentication check was applied,
        // pass that result along without modification.
        if ( true === $result || is_wp_error( $result ) ) {
            return $result;
        }
    
        // No authentication has been performed yet.
        // Return an error if user is not logged in.
        if ( ! is_user_logged_in() ) {
            return new WP_Error(
                'rest_not_logged_in',
                __( 'You are not currently logged in.' ),
                array( 'status' => 401 )
            );
        }
    
        // Our custom authentication check should have no effect
        // on logged-in requests
        return $result;
    });

    My website is https://urlis.net/fzw4o
    How can give access only on your plugin to use JSON ?
    Good day.

    Plugin Author mapster

    (@mapster)

    Hi there! So if I understand correctly, you are blocking all access to wp-json to prevent anonymous users from signing up? It should also be possible to do that via the WP Admin. However, if you’re using this plugin … I don’t think this filter that you posted will be able to validate if it’s the Mapster plugin or not for the request. You need a way to filter the endpoint being queried, not just the final result — this filter only provides the final result where you can check if a user is valid or not.

    Thread Starter spikerrbg

    (@spikerrbg)

    Friend if im use this filter how can give access to your plugin use JSON for non register user.

    // Disable some endpoints for unauthenticated users
    add_filter( 'rest_endpoints', 'disable_default_endpoints' );
    function disable_default_endpoints( $endpoints ) {
        $endpoints_to_remove = array(
            '/oembed/1.0',
            '/wp/v2',
            '/wp/v2/media',
            '/wp/v2/types',
            '/wp/v2/statuses',
            '/wp/v2/taxonomies',
            '/wp/v2/tags',
            '/wp/v2/users',
            '/wp/v2/comments',
            '/wp/v2/settings',
            '/wp/v2/themes',
            '/wp/v2/blocks',
            '/wp/v2/oembed',
            '/wp/v2/posts',
            '/wp/v2/pages',
            '/wp/v2/block-renderer',
            '/wp/v2/search',
            '/wp/v2/categories'
        );
    
        if ( ! is_user_logged_in() ) {
            foreach ( $endpoints_to_remove as $rem_endpoint ) {
                // $base_endpoint = "/wp/v2/{$rem_endpoint}";
                foreach ( $endpoints as $maybe_endpoint => $object ) {
                    if ( stripos( $maybe_endpoint, $rem_endpoint ) !== false ) {
                        unset( $endpoints[ $maybe_endpoint ] );
                    }
                }
            }
        }
        return $endpoints;
    }
    Plugin Author mapster

    (@mapster)

    Hello, I don’t believe the plugin actually uses any of the endpoint you list there. All the endpoints for the plugin are at a custom endpoint, namely, wp/v2/mapster-wp-maps (and then a bunch of custom endpoints created in /admin/api/class-mapster-wordpress-maps-api.php). However it’s possible that some kind of internal logic is blocking fetching post types or permissions based on the other plugins you have installed…

    This is a difficult one to help you with. TO confirm, the plugin works fine when you don’t have the user blocking plugin also installed?

    Thread Starter spikerrbg

    (@spikerrbg)

    Yep work fine when not block endpoint.
    Friend im fix problem dont know what is logic.

    function disable_default_endpoints( $endpoints ) {
        $endpoints_to_remove = array(
            '/oembed/1.0',
            '/wp/v2',
            '/wp/v2/media',
            '/wp/v2/types',
            '/wp/v2/statuses',
            '/wp/v2/taxonomies',
            '/wp/v2/tags',
            '/wp/v2/users',
            '/wp/v2/comments',
            '/wp/v2/settings',
            '/wp/v2/themes',
            '/wp/v2/blocks',
            '/wp/v2/oembed',
            '/wp/v2/posts',
            '/wp/v2/pages',
            '/wp/v2/block-renderer',
            '/wp/v2/search',
            '/wp/v2/categories'
        );

    In this list im add ‘wp/v2/mapster-wp-maps’ and now show for non register user.

    Plugin Author mapster

    (@mapster)

    OK, so it’s fixed? Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Not show after last update custom post type’ is closed to new replies.