• Resolved nevoerez1

    (@nevoerez1)


    I craeted Post Type “lawyers”.
    Everything was OK.
    I don’t what happaned but I get 404 error.
    Permalink Settings are set to “Post name”.

    When i change it to “Plain” – it work ok. when I changed ut back to “Post name”, same 404 error return.
    I want that my Permalink settings will stay on “Post name”.

    How can I fix it?

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Is this url one that should be working if everything was? https://www.lexo.co.il/lawyers

    Curious what settings you may be using, but I’m also curious if you perhaps have any pages also named “lawyers” that may be conflicting in some way.

    Thread Starter nevoerez1

    (@nevoerez1)

    When I changed the permalink settings to Plain, I get this results:
    1. https://www.lexo.co.il/?lawyers=606
    2. https://www.lexo.co.il/?lawyers=349

    After changed it again to “Post name”, and try to enter to each lawyer, I redirect to
    https://www.lexo.co.il/lawyers/ and get 404.

    I don’t have post/ page named “lawyers”

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Did you customize the rewrite settings at all for this post type with CPTUI’s UI?

    Thread Starter nevoerez1

    (@nevoerez1)

    No.
    I hope that I understood what you mean…

    I add this to my functions.php:

    function cptui_register_my_cpts() {

    /**
    * Post Type: lawyers.
    */

    $labels = [
    “name” => __( “lawyers”, “Parallax-One-child” ),
    “singular_name” => __( “lawyer”, “Parallax-One-child” ),
    ];

    $args = [
    “label” => __( “lawyers”, “Parallax-One-child” ),
    “labels” => $labels,
    “description” => “”,
    “public” => true,
    “publicly_queryable” => true,
    “show_ui” => true,
    “show_in_rest” => true,
    “rest_base” => “”,
    “rest_controller_class” => “WP_REST_Posts_Controller”,
    “has_archive” => false,
    “show_in_menu” => true,
    “show_in_nav_menus” => true,
    “delete_with_user” => false,
    “exclude_from_search” => false,
    “capability_type” => “post”,
    “map_meta_cap” => true,
    “hierarchical” => false,
    “rewrite” => [ “slug” => “lawyers”, “with_front” => true ],
    “query_var” => true,
    “supports” => [ “title”, “editor”, “thumbnail” ],
    ];

    register_post_type( “lawyers”, $args );
    }

    add_action( ‘init’, ‘cptui_register_my_cpts’ );

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    When you re-enable the permalink structure you want, where does this link take you? https://www.lexo.co.il/?lawyers=606 It should take you to the single post for that lawyer.

    However, just visiting https://www.lexo.co.il/lawyers/ would still give a 404, because as I can see above, you have “has archive” set to false. If you set that to true, then I believe https://www.lexo.co.il/lawyers/ should kick in.

    Thread Starter nevoerez1

    (@nevoerez1)

    After I changed “has archive” to true, I get the archive page, but still I cannot enter to the lawyer page.

    Please check this video:
    https://www.lexo.co.il/wp-content/uploads/2020/07/20200727_214504.mp4

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Any sort of other permalink customizations or plugins in use? I find it curious that two of the posts link to their post IDs as part of the permalink.

    For example: https://www.lexo.co.il/lawyers/606/

    Thread Starter nevoerez1

    (@nevoerez1)

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    What about things in your theme?

    Also any redirects and whatnot configured with Yoast? Or perhaps via htaccess files?

    Thread Starter nevoerez1

    (@nevoerez1)

    Ok, So now after I set the has_archive to true, I get a new error…

    If I entered to the lawyer page, I get archive page with all the lawyers.
    If I click from the list, it’s return to lawyers list.
    This is thae lawyer page: https://www.lexo.co.il/lawyers/606/

    I also tried to enter to https://www.lexo.co.il/?lawyers=606, altough it’s not the direct url of the lawyer, it’s entered.
    The problem is, this is not the direct link as show in this picture.
    https://www.lexo.co.il/wp-content/uploads/2020/07/lawyer-details.png

    Any idaes?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not sure what to suggest here at this point, something within the install seems to be affecting things here. The post type settings provided about 2 days ago don’t show any warning signs to me, so something somewhere has to be interfering.

    Thread Starter nevoerez1

    (@nevoerez1)

    What do you suggest to do?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Outside of checking things already mentioned above, best i can offer is the idea of whittling things down to as basic as possible, if at all possible For example, only CPTUI active, one of the default themes active, check and see if things work at that point, and then start reactivating intended theme and plugins to see if the issue comes back at some point. Once it does, we know where potential conflicts are coming from.

    Sadly I also have very limited experience with right to left languages, so that’s an efficiency blocker on my part.

    Thread Starter nevoerez1

    (@nevoerez1)

    Please helpppp
    I dont know what to do.
    new theme.
    Permalink Settings are set to “Post name”.
    When I tried to enter to the lawyer page, I redirect to archive.

    How it make sense?
    Why the custom post type redirect to archive instead of post type page?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Don’t know what to tell you at this point. Have you tried making a brand new post, perhaps one that doesn’t have numbers or hebrew characters for the permalink slugs? It could potentially be playing a part, but hopefully not.

    I’ve used the snippet/export above to drop in a local WordPress install and I’m not seeing the same issues, so I don’t think it’s necessarily something to do with the settings put into CPTUI.

Viewing 15 replies - 1 through 15 (of 17 total)

The topic ‘custom posts give 404’ is closed to new replies.