I created a project form for adding projects,but when I create it,a wrong link create this is how I created project form:

 add_action('init' , 'create_project');
function create_project()
    $labels = array(
        'name' => _x('پروژه های جدید', 'post type general name'),
        'singular_name' => _x('پروژه', 'post type singular name'),
        'add_new' => _x('افزودن', 'پروژه'),
        'add_new_item' => __('افزودن پروژه'),
        'edit_item' => __('ویرایش پروژه'),
        'new_item' => __('جدید پروژه'),
        'view_item' => __('نمایش پروژه'),
        'search_items' => __('جستجوی پروژه'),
        'not_found' => __('پروژهی وجود ندارد'),
        'not_found_in_trash' => __('در زباله دان پروژهی نیست'),
        'parent_item_colon' => __('ویرایش پروژه'),

    $support = array('title', 'excerpt', 'custom-fields', 'editor', 'thumbnail');

    register_post_type('project', array(
        'labels' => $labels,
        'supports' => $support,
        'public' => true



<?php if (have_posts()){ ?>
<section class="page-title parallax-section">
    <div class="row-parallax-bg">
        <div class="parallax-wrapper">
            <div class="parallax-bg">
                <img src="images/bg-image-54.jpg" alt="">
        <div class="parallax-overlay"></div>
    <div class="centrize">
        <div class="v-center">
            <div class="container">
                <div class="single-post-info">
                    <h6><span><i class="hc-clock"></i>تاریخ پست</span><span class="post-time">22<?php the_date('D/M/Y') ?></span><span> در <a href="#"><?php the_category(); ?></a></span></h6>
                    <div class="title text-center">
                        <h1>لورم ایپسوم متن ساختگی با </h1>
                    <div class="post-author">
                        <img src="images/testimonial-2.jpg" alt=""><a href="#"><?php the_modified_author(); ?></a>
                <?php the_meta(); ?>
<?php } ?>

the link that creating is:'http://localhost/wordpress/faradars/project/project/' and it open 404page can anyone help me to fix it?

  • Have you made sure to flush your permalinks by going to Settings > Permalinks? – Jacob Peattie May 28 at 13:54
  • actully no,what should I do? – hadis May 28 at 14:12
  • Go to Settings > Permalinks. That’s it. – Jacob Peattie May 28 at 14:50

By analysis, your code maybe you should try

  • Flush permalinks (This may solve this issue) because when we create custom post type in WordPress we should use flush_rewrite_rules() or manually update permalinks.

Hope it will solve this issue.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.