Giter VIP home page Giter VIP logo

Comments (4)

soderlind avatar soderlind commented on August 22, 2024

Try this, replace

flush_rewrite_rules();

with

global $wp_rewrite;
$wp_rewrite->flush_rules();

from epoch.

Shelob9 avatar Shelob9 commented on August 22, 2024

@soderlind Yes, that is often the best way to do it. -1 me.

I know that epoch-api, pre-this version worked properly with ugly permalinks. Which might mean that the flush never worked, but wasn't needed. Got to check if the new rewrite rule for the iFrame is in fact ugly permalinks compatible, and our flush enables that.

from epoch.

soderlind avatar soderlind commented on August 22, 2024

In my example plugin, I only flush if the permalink doesn't exist:

/**************************************************************************
 * Flushes the permalink structure.
 * flush_rules is an extremely costly function in terms of performance, and
 * should only be run when changing the rule.
 *
 * @see http://codex.wordpress.org/Rewrite_API/flush_rules
 **************************************************************************/
function my_permalink_flush_rewrite_rules() {
    $rules = $GLOBALS['wp_rewrite']->wp_rewrite_rules();
    if ( ! isset( $rules['my-permalink/(.*)$'] ) ) { // must be the same rule as in my_permalink_rewrite_rule($wp_rewrite)
        global $wp_rewrite;
        $wp_rewrite->flush_rules();
    }
}

from epoch.

Shelob9 avatar Shelob9 commented on August 22, 2024

close via a24c41f

from epoch.

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.