Guest User

Untitled

a guest
Sep 1st, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. add_filter( 'pre_handle_404', function($param1, $param2) {
  2. $post_id = url_to_postid("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
  3. if (!empty($post_id)) {
  4. $td_post_theme_settings = td_util::get_post_meta_array( $post_id, 'td_post_theme_settings' );
  5. if ( is_array( $td_post_theme_settings ) && array_key_exists( 'smart_list_template', $td_post_theme_settings ) ) {
  6. return true;
  7. } elseif ( td_global::is_tdb_registered() && td_global::is_tdb_template($td_post_theme_settings['td_post_template'], true) ) {
  8. $td_template_id = td_global::tdb_get_template_id($td_post_theme_settings['td_post_template']);
  9. $td_template_content = get_post_field('post_content', $td_template_id);
  10. $is_tdb_smartlist = tdb_util::get_shortcode($td_template_content, 'tdb_single_smartlist');
  11. if ( $is_tdb_smartlist ) {
  12. return true;
  13. }
  14. }
  15. }
  16. return $param1;
  17. }, 10, 2);
Add Comment
Please, Sign In to add comment