• Hey, this one is a bit complicated to explain so I have broken the post down into pieces so you can skip ahead.

    1) Background
    2) Problem
    3) Question
    4) Source Code

    == Background ==

    I am in the process of creating a simple script that will pull a pre-defined column from a non-WP table and adding it as a POST to the wp_post table. Also, it is supposed to fall under a user selected category so when the end user browses the site, they can select a category and see all the newly imported posts.

    == Problem ==

    I am updating the wp_term_relationships table to match the wp_post.ID to the wp_term_relationships.object_id so that the new posts are created under the proper category. However, when I browse the site by category, all the new posts will fall under the correct category, but using any sort of paging or sorting fails to detect the new posts.

    == Question ==

    Is there a step or item I am forgetting to update in the database to make the links work, or should I be using a custom template function to make the paging/sorting work? I would like to on the single.php template have it so you can see the name of the next and previous posts within that same category sorted alphabetically by post_title, and then click on the links to actually go to the respective post.

    == Source Code ==

    Not sure if this is okay, but here is a pastebin.com link to the functions.php script I am writing containing all of the SQL code.

    https://pastebin.com/f2a678a71

    Before I forget, thanks for taking the time to read this and help me out as I am still new to WordPress and am trying to learn the ropes.

  • The topic ‘Manually Set Post Categories’ is closed to new replies.