Giter Site home page Giter Site logo

Comments (3)

danielbachhuber avatar danielbachhuber commented on June 1, 2024

This impliments a flag to allow use of wp_remote_get so that you can import from those locations. Writtent to cope with managing some private domain/LAN sites.

Can you share an example?

Is it possible to solve this problem with an existing filter?

from media-command.

phlbnks avatar phlbnks commented on June 1, 2024

I took wp-cli/wp-cli#1310 to mean that add_filter couldn't be used in WP CLI commands but if I mis-read/interpreted that then there's the http_request_reject_unsafe_urls filter which would be much cleaner!
I searched before trying so can go and test it unless there is anything different about using filters in CLI?

My example was a new intranet for a client:
Old site http://nww.domain.co.uk on serverA
New site http://nw2.domain.co.uk on serverB
Running wp media import http://nww.domain.co.uk/path/to/image.jpg from nw2 failed with invalid URL. I tracked it down to https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/http.php#L547 where it fails as the IP for nww is local (both are in fact).

from media-command.

danielbachhuber avatar danielbachhuber commented on June 1, 2024

I took wp-cli/wp-cli#1310 to mean that add_filter couldn't be used in WP CLI commands but if I mis-read/interpreted that then there's the http_request_reject_unsafe_urls filter which would be much cleaner!

Yes, you can put your filter in a mu-plugin or similar, and then it will run when you use wp media import.

I searched before trying so can go and test it unless there is anything different about using filters in CLI?

I think this particular need is best implemented as a standalone plugin, not something that needs to happen as an enhancement to wp media import.

from media-command.

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.