Giter Site home page Giter Site logo

Comments (12)

swalkinshaw avatar swalkinshaw commented on August 18, 2024

This is a bit confusing to me. Can you share an example of what your theme is before/after? Do you mean the path in wp_options table somewhere?

from bedrock.

theantichris avatar theantichris commented on August 18, 2024

It is the default Twenty Fourteen theme right now. I just switch it to another theme then back and it fixes.

Specifically it looks like the template_root option in the wp_options table is not be updated after a deploy. It is still pointing to the previous release in the releases folder.

from bedrock.

swalkinshaw avatar swalkinshaw commented on August 18, 2024

Are you using Apache or Nginx?

from bedrock.

theantichris avatar theantichris commented on August 18, 2024

Nginx.

from bedrock.

swalkinshaw avatar swalkinshaw commented on August 18, 2024

Interesting that this hasn't come up before. WP does some complicated stuff to do with theme and template directories. It seems like this is only triggered if you have multiple theme directories (which Bedrock does by default). I always remove https://github.com/roots/bedrock/blob/master/web/app/mu-plugins/register-theme-directory.php which means this wouldn't happen.

See here for example: https://github.com/WordPress/WordPress/blob/666fec5144eb3f7df7ee08e345a2e11db4d292ee/wp-includes/theme.php#L604-L627

This will probably take more debugging. One interim solution would be to include a WP-CLI command during the cap deploy process.

Something like:

namespace :deploy do
  task :update_options do
    on roles(:app) do
      within fetch(:current_path) do
        execute :wp, :option, :set, fetch(:release_path).join('subdir/to/themes')
      end
    end
  end
end

after 'deploy:publishing', 'update_options'

from bedrock.

theantichris avatar theantichris commented on August 18, 2024

Thanks for looking into this.

I tried the wp-cli stuff but it kept telling me "Error: This does not seem to be a WordPress install." even with the yml file there or specifying the path on the command.

I can hold tight with just switching themes until a solution is found.

from bedrock.

swalkinshaw avatar swalkinshaw commented on August 18, 2024

That's because I was missing the within block so it wasn't running in that directory to pick up the wp.yml file. Try again with the edited code above.

from bedrock.

theantichris avatar theantichris commented on August 18, 2024

Thanks. I just removed the plugin file since I don't need multiple theme directories. That has me fixed for now.

from bedrock.

liviucmg avatar liviucmg commented on August 18, 2024

The solution posted by @swalkinshaw worked for me with just a minor change. The "current_path" variable is empty for some reason, so I've replaced it with "release_path". The following code works on Capistrano 3.2.1 and WordPress 4.0 when deployed to Ubuntu 14.04 + Nginx + PHP-FPM (though the deploy target shouldn't really matter):

namespace :deploy do
  desc 'Update WordPress theme path to the new release'
  task :update_options do
    on roles(:app) do
      within fetch(:release_path) do
        execute :wp, :option, :set, :template_root, fetch(:release_path).join('web/wp/wp-content/themes')
      end
    end
  end
end

Note that this requires WP-CLI installed on the server. I'll be making a pull request, since the issue is present on all of my websites. Strange that it appeared fairly recently. Maybe a recent WordPress update caused it?

from bedrock.

grahamharper avatar grahamharper commented on August 18, 2024

I was getting the white screen of death too but the fix proposed @liviucmg and @swalkinshaw didn't fix this issue for me because I noticed the stylesheet_root wasn't being updated either. I added a new execute line to update this too.

namespace :deploy do
  desc 'Update WordPress theme path to the new release'
  task :update_options do
    on roles(:app) do
      within fetch(:release_path) do
        execute :wp, :option, :set, :template_root, fetch(:release_path).join('web/wp/wp-content/themes')
        execute :wp, :option, :set, :stylesheet_root, fetch(:release_path).join('web/wp/wp-content/themes')
      end
    end
  end
end

from bedrock.

swalkinshaw avatar swalkinshaw commented on August 18, 2024

@grahamharper see my other solution here: #101 (comment)

from bedrock.

grahamharper avatar grahamharper commented on August 18, 2024

Gah, sorry, just saw that now. Cheers. At least the comment might be useful for other folks.

from bedrock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.