1

I have uploaded a selection of audio files via the media uploader.

I can successfully open an attachment page (single.php) for each file.

However, the 'previous_post_link()' generates the current post URL and the 'next_post_link()' doesn't do anything. They both return 'null' when doing a var_dump.

For example, I'm on an attachment page for the audio file Dusty Road, and 'previous_post_link()' puts 'http://localhost/wordpress-theme/dusty-road/' as the previous post URL. This is obviously not what I want.

I have these links working correctly on single pages for the default post type and a custom post type. Single image attachment pages successfully use 'previous_image_link()' and 'next_image_link()'.

What could be going on here?

I'm working in a child theme of Twentysixteen.

Thanks!

Your Answer

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

Browse other questions tagged or ask your own question.