Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add New Post breaks when add_theme_support is used #1297

Closed
loratov opened this issue Jul 31, 2018 · 6 comments
Closed

Add New Post breaks when add_theme_support is used #1297

loratov opened this issue Jul 31, 2018 · 6 comments

Comments

@loratov
Copy link

loratov commented Jul 31, 2018

The add new post url breaks when I add the template directory through the add_theme_support function. I keep getting a 302 error when I try to visit that page.

error: [302]: /?p=39735&amp&amp_validate=1&amp_cache_bust=58240603

url : http://localhost:8080/wp/wp-admin/post-new.php

code:
add_action( 'after_setup_theme', function() { add_theme_support( 'amp', array( 'template_dir' => 'amp-templates/', 'available_callback' => 'is_singular', )); } );

@westonruter
Copy link
Member

Are you using 0.7?

Is your home URL set to http://localhost:8080/ or http://localhost:8080/wp/ ?

@westonruter
Copy link
Member

And by “breaks” you mean there is an error in the log. The new post screen is still accessible as normal, correct?

@loratov
Copy link
Author

loratov commented Aug 1, 2018

I'm using 0.7.2

home url: http://localhost:8080
wp url: http://localhost:8080/wp

The New Post screen is inaccessible - I just get a white screen and then the server stops responding. I'm using the PHP built-in web server and receive the following notifications:


desktop screenshot

It can take a few times upon visiting the page for it to happen. For example, I just tried it and it was successful the first four times or so and then it became inaccessible.

I tried implementing the function only on the front end of the site and not in the admin and that does seem to resolve the issue.

add_action( 'after_setup_theme', function() { if (!is_admin()) { add_theme_support( 'amp', array( 'template_dir' => 'amp-templates/', 'available_callback' => 'is_singular', )); } } );

@westonruter
Copy link
Member

Can you edit an existing post and save changes?

@loratov
Copy link
Author

loratov commented Aug 2, 2018

Yes, editing existing post and saving it has been only.

@westonruter
Copy link
Member

Well, I created a fix for a related issue in #1301. If you can test the latest develop version then you'd be able to confirm if it fixes your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants