• hunterhogan

    (@hunterhogan)


    I’m sure the answer to this is somewhere, but I’ve searched for hours without finding it, so I apologize for asking such a basic question.

    Goal
    I want the permalinks for all of my attachments to format this way:
    domain.com/%category%/%postname%

    I would like %category% == the category of the attachment, not the category of some “Post” it is attached to

    I would like %postname% == the Slug of the attachment

    Status
    Currently, the permalink for my attachment looks like this:
    domain.com/?attachment_id=[###]

    My testing page: http://www.hunterthinks.com/?attachment_id=249
    [I have not completed attachment.php, so it is not pretty. header.php and footer.php should be correct, however.]

    Under my current testing conditions, I want the permalink for this attachment to be http://www.hunterthinks.com/photograph/latina_19-2 (case sensitive), but that serves WordPress’s 404 page.

    In the Media Library, I have added this attachment to exactly one category. It is named “Photography” and the slug is “photograph”. The category name properly displays in header.php

    <h2 id="section_name">
        <?php
          if ( is_single() )
            { global $post;
              $categories = get_the_category($post->ID);
              echo '<a href="'.get_category_link($categories[0]->term_id ).'">'.$categories[0]->cat_name.'</a>';
            }
          else
            {bloginfo( 'description' );}
        ?></h2>

    That makes me feel that the database understands that this attachment is in the Photography category.

    In the media library, I changed the slug to “latina_19-2” merely to test if I could change the slug. Nothing happened.

    No tags assigned. I’ve tried with and without caption, alt, and description. No luck.

    Environment
    Hosted on GoDaddy Linux Economy
    I swear I saw a screen with info about the PHP and Apache version, but I can’t find it now. As I recall, both are the latest versions.

    Plugins, all are the most recent, with some emphasized:

    1. Advanced Custom Fields
    2. Broken Link Checker
    3. Facebook
    4. Google Analytics for WordPress
    5. Jetpack by WordPress.com; the only enabled options:
    1. WordPress.com Stats
    2. Spelling and Grammar
    3. Omnisearch
    4. Shortcode Embeds
    5. Jetpack Single Sign On
    • Justified Image Grid
    • Media Library Assistant
    • Simple URLs
    • Super Socializer (problem existed before this was installed)
    • Theme Check
    • UpdraftPlus – Backup/Restore
    • Use Google Libraries
    • W3 Total Cache
    • WordPress SEO
    • WP Total Hacks
    • I have not changed anything in Yoast WordPress SEO: Permalinks. To be clear, “Redirect attachment URL’s to parent post URL.” is not checked.

      Troubleshooting
      I normally take notes when troubleshooting a problem, but I didn’t realize this was a problem until I had tried a bunch of things. I was sure that the issue was PEBCAK, so I just kept digging. Therefore, I don’t have a list of steps I tried. I have reinstalled 3.8.2 twice.

      I have no idea if this is related, but if I am in the Media library and I edit Attachment information (such as update the Alt Text), then click update, I get the following error:

      Notice: Undefined index: post_status in /home/content/h/u/n/hunterhogan/html/wp-admin/includes/post.php on line 206

      Warning: Cannot modify header information – headers already sent by (output started at /home/content/h/u/n/hunterhogan/html/wp-admin/includes/post.php:206) in /home/content/h/u/n/hunterhogan/html/wp-includes/pluggable.php on line 896

      It’s on a plain white screen, but if I go back to the library, all of the changes were updated.

      The answer to my permalink issue might be, “It’s not possible,” which would be less than ideal, but at least I would know the answer!

      Working pages
      I haven’t completed all of my theme pages, but my homepage is served as a static page and the following three pages are testing pages I use. The pages work, so I feel that most of WordPress is operating as intended. (I haven’t created the category pages yet, though.)
      http://www.hunterthinks.com/
      http://www.hunterthinks.com/uncategorized/hello-world
      http://www.hunterthinks.com/photograph/portriats
      http://www.hunterthinks.com/game/creeper-world-user-space

      What am I missing?
      This is my first WordPress site, so I may be missing something obvious in the codex or the settings. Can someone point me in the right direction?

      Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom permalinks for attachments’ is closed to new replies.