• Resolved shuangmiles

    (@shuangmiles)


    Hi I am looking to do a wp_query and get pages that have the lp part of urls like this lp/acumatica-alternative for example. This is a text field in the Current URI section of the edit for a page. Is it part of metaquery any ideas how to do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I would first ask how the “lp” parts are created? How do you create them in your project? Do you use a specific plugin for this or do you enter them manually as a permalink of a page or a post?

    Thread Starter shuangmiles

    (@shuangmiles)

    It’s entered manually in the current uri section of the permalink manager.

    So you mean this plugin?
    https://www.ads-software.com/plugins/permalink-manager/

    This stores these individual URLs (currently) in an option field. This could be read out as follows to get the desired URLs:

    $uris = get_option('permalink-manager-uris', true);
    $uris_with_lp_part = [];
    foreach( $uris as $post_id => $uri ) {
        if( false !== strpos($uri, 'lp/') ) {
            $uris_with_lp_part[$post_id] = $uri;
        }
    }
    var_dump($uris_with_lp_part);

    If you have further questions about this, I would recommend you to contact the plugin’s support directly. There may also be alternative ways: https://www.ads-software.com/support/plugin/permalink-manager/

    If you don’t mean this plugin, I would need to know exactly what you mean instead. Because without any plugin wordpress always saves this slug without a “/” which you put in artificially, so I assume that you use a plugin like the one mentioned here.

    Thread Starter shuangmiles

    (@shuangmiles)

    This was really helpful I got it to work!

    Nice to read. You are welcome to set the topic to solved.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Is there a way to do a wp_query based off of the current uri field’ is closed to new replies.