Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress - adding post category requires page refresh to show up

I have built a new theme on the latest version of Wordpress (Version 3.3.1 as of this post).

When adding a new category, (both in a regular post or custom post) the new category doesnt appear, I have to actually refresh the page in order for it to show up. If I am writing a new post that means I need to save / publish a post before I can refresh the page. This is a bit annoying as normally I am used to Wordpress adding the new category and updating the page asynchronously so I can then choose the new category straight away.

Has anyone had this happen to them before? I have kept my theme really light at the moment so not sure what could be causing it. Pretty much all my functions code is for the custom post types I have been making, but the issue is present for standard posts too.

Anyone got any ideas?

EDIT FIXED I just needed to clean up my functions file by removing some whitespace

like image 269
richimgd Avatar asked Mar 04 '12 18:03

richimgd


People also ask

Why are my categories not showing in WordPress?

Go to Posts ->All Posts and check if it's showing the tags and categories there. If not, click on Edit or Quick Edit under the post title and add them again.

How do I link a category to a page in WordPress?

To add a category, head over Pages » Categories from your WordPress dashboard and then enter a 'Name' and 'Slug' for your category. After that, you can scroll down and select a 'Parent Category' for your category. Once you've entered these details, simply click the 'Add New Category' button.

How do I show post categories in WordPress?

Simply go to the Appearance » Widgets page and add the 'Latest Posts' block to your sidebar. By default, the block will show your most recent posts. You edit the block settings and scroll to the 'Sorting & Filtering' section. From here, you can choose the category that you want to display posts from.

How do I refresh the current page in WordPress?

If you want to reload the page in javascript (the question was tagged with javascript) you can use the Location#reload() method: document. location. reload(true);


1 Answers

Just in case anyone else runs into this problem, one of the main reasons stuff like this could go wrong is because of white space before and after the opening and closing PHP tags, respectively, in your functions.php file of your theme.

More information can be found in the Wordpress FAQ and troubleshooting section.

like image 128
Artful Dodger Avatar answered Nov 15 '22 10:11

Artful Dodger