Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress custom post type post and category links 404
    primarykey
    data
    text
    <p>I've recently created several custom post types in a wordpress site, with the code below, they are generating links in the correct form e.g. root/category/id/postname but each link to the full post, pagination or category 404's. </p> <p>I've tried a number of popular solutions, appending /%category%/%post_id%/ to the url structure, rewriting function names but I'm getting nowhere fast.</p> <p>With the wordpress permalink structure set to default e.g. root/?page_id=1257 everything works ok. </p> <p>Any effort to add additional parameters to rewrite (see below) produces "Parse error: syntax error, unexpected ';'" even though no ';' is present.</p> <pre><code>'rewrite' =&gt; array( 'slug' =&gt; 'issue') </code></pre> <p>Any help appreciated - highly confused, very frustrated!</p> <pre><code>&lt;?php // CUSTOM POST TYPE 1 add_action('init', 'mjwpress_register'); function mjwpress_register() { $args = array( 'label' =&gt; __('Press'), 'singular_label' =&gt; __('Press'), 'public' =&gt; true, 'show_ui' =&gt; true, 'capability_type' =&gt; 'post', 'new_item' =&gt; __('New Press Item'), 'hierarchical' =&gt; false, 'rewrite' =&gt; true, 'supports' =&gt; array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'comments', 'revisions', 'page-attributes', 'post-formats') ); register_taxonomy('press-category', array('article'), array( 'label' =&gt; 'Press Story Category', 'singular_label' =&gt; 'press-story-category', 'public' =&gt; TRUE, 'show_tagcloud' =&gt; TRUE, 'hierarchical' =&gt; TRUE, 'query_var' =&gt; TRUE, 'menu_position' =&gt; 5, 'rewrite' =&gt; TRUE) ); register_post_type( 'mjwpress' , $args ); } add_action('inthenews_init', 'inthenews_init'); add_action('save_post', 'save_mjwpress_options'); function inthenews_init(){ add_meta_box('newsmeta', 'Press Options', 'mjwpress_meta_options', 'mjwpress', 'normal', 'low'); } function mjwpress_meta_options(){ global $post; $custom = get_post_custom($post-&gt;ID); $linkurl = $custom['linkurl'][0]; $linktitle = $custom['linktitle'][0]; ?&gt; &lt;div class='form-wrap'&gt; &lt;div class='form-field'&gt; &lt;label for='linkurl'&gt;Link to External Publication:&lt;/label&gt; &lt;input name='linkurl' value='&lt;?php echo $linkurl; ?&gt;' /&gt; &lt;p&gt;E.g. http://www.example.com/article-title.php&lt;/p&gt; &lt;/div&gt; &lt;div class='form-field'&gt; &lt;label for='linktitle'&gt;Title of External Publication:&lt;/label&gt; &lt;input name='linktitle' value='&lt;?php echo $linktitle; ?&gt;' /&gt; &lt;p&gt;E.g. Lib Dem Voice&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php } function save_mjwpress_options(){ global $post; update_post_meta($post-&gt;ID, 'linkurl', $_POST['linkurl']); update_post_meta($post-&gt;ID, 'linktitle', $_POST['linktitle']); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload